// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

package jagex.client;

import jagex.CacheLoader;
import jagex.PacketConstruction;
import jagex.DataOperations;
import java.io.IOException;
import java.io.PrintStream;

// Referenced classes of package jagex.client:
//            h, s, q, k, 
//            i, a

public class Camera {

	public Camera(GameImage arg0, int arg1, int arg2, int arg3) {
		xl = 50;
		yl = new int[xl];
		zl = new int[xl][256];
		cm = 5;
		zoom1 = 1000;
		zoom2 = 1000;
		zoom3 = 20;
		zoom4 = 10;
		jm = false;
		km = 1.1000000000000001D;
		lm = 1;
		mm = false;
		qm = 100;
		rm = new Model[qm];
		sm = new int[qm];
		tm = 512;
		um = 256;
		vm = 192;
		wm = 256;
		xm = 256;
		ym = 8;
		zm = 4;
		so = new int[40];
		to = new int[40];
		uo = new int[40];
		vo = new int[40];
		wo = new int[40];
		xo = new int[40];
		yo = false;
		no = arg0;
		um = arg0.menuDefaultWidth / 2;
		vm = arg0.menuDefaultHeight / 2;
		oo = arg0.imagePixelArray;
		gn = 0;
		hn = arg1;
		in = new Model[hn];
		jn = new int[hn];
		kn = 0;
		ln = new CameraModel[arg2];
		for (int l = 0; l < arg2; l++) {
			ln[l] = new CameraModel();
		}

		nn = 0;
		vn = new Model(arg3 * 2, arg3);
		on = new int[arg3];
		sn = new int[arg3];
		tn = new int[arg3];
		pn = new int[arg3];
		qn = new int[arg3];
		rn = new int[arg3];
		un = new int[arg3];
		if (lo == null) {
			lo = new byte[17691];
		}
		an = 0;
		bn = 0;
		cn = 0;
		dn = 0;
		en = 0;
		fn = 0;
		for (int i1 = 0; i1 < 256; i1++) {
			im[i1] = (int) (Math.sin((double) i1 * 0.02454369D) * 32768D);
			im[i1 + 256] = (int) (Math.cos((double) i1 * 0.02454369D) * 32768D);
		}

		for (int j1 = 0; j1 < 1024; j1++) {
			hm[j1] = (int) (Math.sin((double) j1 * 0.00613592315D) * 32768D);
			hm[j1 + 1024] = (int) (Math.cos((double) j1 * 0.00613592315D) * 32768D);
		}

	}

	public void addModel(Model arg0) {
		if (gn < hn) {
			jn[gn] = 0;
			in[gn++] = arg0;
		}
	}

	public void removeModel(Model arg0) {
		for (int l = 0; l < gn; l++) {
			if (in[l] == arg0) {
				gn--;
				for (int i1 = l; i1 < gn; i1++) {
					in[i1] = in[i1 + 1];
					jn[i1] = jn[i1 + 1];
				}

			}
		}

	}

	public void cleanupModels() {
		vh();
		for (int l = 0; l < gn; l++) {
			in[l] = null;
		}

		gn = 0;
	}

	public void vh() {
		nn = 0;
		vn.re();
	}

	public void ei(int arg0) {
		nn -= arg0;
		vn.ge(arg0, arg0 * 2);
		if (nn < 0) {
			nn = 0;
		}
	}

	public int si(int arg0, int arg1, int arg2, int arg3, int arg4, int arg5) {
		on[nn] = arg0;
		pn[nn] = arg1;
		qn[nn] = arg2;
		rn[nn] = arg3;
		sn[nn] = arg4;
		tn[nn] = arg5;
		un[nn] = 0;
		int l = vn.zd(arg1, arg2, arg3);
		int i1 = vn.zd(arg1, arg2 - arg5, arg3);
		int ai1[] = { l, i1 };
		vn.ie(2, ai1, 0, 0);
		vn.rh[nn++] = 0;
		return nn - 1;
	}

	public int fh(int arg0, int arg1, int arg2, int arg3, int arg4, int arg5,
			int arg6) {
		on[nn] = arg0;
		pn[nn] = arg1;
		qn[nn] = arg2;
		rn[nn] = arg3;
		sn[nn] = arg4;
		tn[nn] = arg5;
		un[nn] = 0;
		int l = vn.zd(arg1, arg2, arg3);
		int i1 = vn.zd(arg1, arg2 - arg5, arg3);
		int ai1[] = { l, i1 };
		vn.ie(2, ai1, 0, 0);
		vn.qh[nn] = arg6;
		vn.rh[nn++] = 0;
		return nn - 1;
	}

	public void gh(int arg0) {
		vn.rh[arg0] = 1;
	}

	public void setCombat(int arg0, int arg1) {
		un[arg0] = arg1;
	}

	public void ph(int arg0, int arg1) {
		nm = arg0 - wm;
		om = arg1;
		pm = 0;
		mm = true;
	}

	public int mi() {
		return pm;
	}

	public int[] hi() {
		return sm;
	}

	public Model[] ih() {
		return rm;
	}

	public void setCameraSize(int arg0, int arg1, int arg2, int arg3, int arg4, int arg5) {
		um = arg2;
		vm = arg3;
		wm = arg0;
		xm = arg1;
		tm = arg4;
		ym = arg5;
		po = new CameraVariables[arg3 + arg1];
		for (int l = 0; l < arg3 + arg1; l++) {
			po[l] = new CameraVariables();
		}

	}

	private void kh(CameraModel arg0[], int arg1, int arg2) {
		if (arg1 < arg2) {
			int l = arg1 - 1;
			int i1 = arg2 + 1;
			int j1 = (arg1 + arg2) / 2;
			CameraModel q1 = arg0[j1];
			arg0[j1] = arg0[arg1];
			arg0[arg1] = q1;
			int k1 = q1.jfb;
			while (l < i1) {
				do {
					i1--;
				} while (arg0[i1].jfb < k1);
				do {
					l++;
				} while (arg0[l].jfb > k1);
				if (l < i1) {
					CameraModel q2 = arg0[l];
					arg0[l] = arg0[i1];
					arg0[i1] = q2;
				}
			}
			kh(arg0, arg1, i1);
			kh(arg0, i1 + 1, arg2);
		}
	}

	public void bh(int arg0, CameraModel arg1[], int arg2) {
		for (int l = 0; l <= arg2; l++) {
			arg1[l].pfb = false;
			arg1[l].qfb = l;
			arg1[l].rfb = -1;
		}

		int i1 = 0;
		do {
			while (arg1[i1].pfb) {
				i1++;
			}
			if (i1 == arg2) {
				return;
			}
			CameraModel q1 = arg1[i1];
			q1.pfb = true;
			int j1 = i1;
			int k1 = i1 + arg0;
			if (k1 >= arg2) {
				k1 = arg2 - 1;
			}
			for (int l1 = k1; l1 >= j1 + 1; l1--) {
				CameraModel q2 = arg1[l1];
				if (q1.bfb < q2.dfb && q2.bfb < q1.dfb && q1.cfb < q2.efb
						&& q2.cfb < q1.efb && q1.qfb != q2.rfb && !ch(q1, q2)
						&& ah(q2, q1)) {
					pi(arg1, j1, l1);
					if (arg1[l1] != q2) {
						l1++;
					}
					j1 = fp;
					q2.rfb = q1.qfb;
				}
			}

		} while (true);
	}

	public boolean pi(CameraModel arg0[], int arg1, int arg2) {
		do {
			CameraModel q1 = arg0[arg1];
			for (int l = arg1 + 1; l <= arg2; l++) {
				CameraModel q2 = arg0[l];
				if (!ch(q2, q1)) {
					break;
				}
				arg0[arg1] = q2;
				arg0[l] = q1;
				arg1 = l;
				if (arg1 == arg2) {
					fp = arg1;
					gp = arg1 - 1;
					return true;
				}
			}

			CameraModel q3 = arg0[arg2];
			for (int i1 = arg2 - 1; i1 >= arg1; i1--) {
				CameraModel q4 = arg0[i1];
				if (!ch(q3, q4)) {
					break;
				}
				arg0[arg2] = q4;
				arg0[i1] = q3;
				arg2 = i1;
				if (arg1 == arg2) {
					fp = arg2 + 1;
					gp = arg2;
					return true;
				}
			}

			if (arg1 + 1 >= arg2) {
				fp = arg1;
				gp = arg2;
				return false;
			}
			if (!pi(arg0, arg1 + 1, arg2)) {
				fp = arg1;
				return false;
			}
			arg2 = gp;
		} while (true);
	}

	public void li(int arg0, int arg1, int arg2) {
		int l = -dn + 1024 & 0x3ff;
		int i1 = -en + 1024 & 0x3ff;
		int j1 = -fn + 1024 & 0x3ff;
		if (j1 != 0) {
			int k1 = hm[j1];
			int j2 = hm[j1 + 1024];
			int i3 = arg1 * k1 + arg0 * j2 >> 15;
			arg1 = arg1 * j2 - arg0 * k1 >> 15;
			arg0 = i3;
		}
		if (l != 0) {
			int l1 = hm[l];
			int k2 = hm[l + 1024];
			int j3 = arg1 * k2 - arg2 * l1 >> 15;
			arg2 = arg1 * l1 + arg2 * k2 >> 15;
			arg1 = j3;
		}
		if (i1 != 0) {
			int i2 = hm[i1];
			int l2 = hm[i1 + 1024];
			int k3 = arg2 * i2 + arg0 * l2 >> 15;
			arg2 = arg2 * l2 - arg0 * i2 >> 15;
			arg0 = k3;
		}
		if (arg0 < zo) {
			zo = arg0;
		}
		if (arg0 > ap) {
			ap = arg0;
		}
		if (arg1 < bp) {
			bp = arg1;
		}
		if (arg1 > cp) {
			cp = arg1;
		}
		if (arg2 < dp) {
			dp = arg2;
		}
		if (arg2 > ep) {
			ep = arg2;
		}
	}

	public void qi() {
		yo = no.rk;
		int l3 = um * zoom1 >> ym;
		int i4 = vm * zoom1 >> ym;
		zo = 0;
		ap = 0;
		bp = 0;
		cp = 0;
		dp = 0;
		ep = 0;
		li(-l3, -i4, zoom1);
		li(-l3, i4, zoom1);
		li(l3, -i4, zoom1);
		li(l3, i4, zoom1);
		li(-um, -vm, 0);
		li(-um, vm, 0);
		li(um, -vm, 0);
		li(um, vm, 0);
		zo += an;
		ap += an;
		bp += bn;
		cp += bn;
		dp += cn;
		ep += cn;
		in[gn] = vn;
		vn.eh = 2;
		for (int l = 0; l < gn; l++) {
			in[l].de(an, bn, cn, dn, en, fn, ym, cm);
		}

		in[gn].de(an, bn, cn, dn, en, fn, ym, cm);
		kn = 0;
		for (int j4 = 0; j4 < gn; j4++) {
			Model h1 = in[j4];
			if (h1.fh) {
				for (int i1 = 0; i1 < h1.rg; i1++) {
					int k4 = h1.sg[i1];
					int ai2[] = h1.tg[i1];
					boolean flag = false;
					for (int j5 = 0; j5 < k4; j5++) {
						int l1 = h1.mg[ai2[j5]];
						if (l1 <= cm || l1 >= zoom1) {
							continue;
						}
						flag = true;
						break;
					}

					if (flag) {
						int k2 = 0;
						for (int j6 = 0; j6 < k4; j6++) {
							int i2 = h1.ng[ai2[j6]];
							if (i2 > -um) {
								k2 |= 1;
							}
							if (i2 < um) {
								k2 |= 2;
							}
							if (k2 == 3) {
								break;
							}
						}

						if (k2 == 3) {
							int l2 = 0;
							for (int k7 = 0; k7 < k4; k7++) {
								int j2 = h1.og[ai2[k7]];
								if (j2 > -vm) {
									l2 |= 1;
								}
								if (j2 < vm) {
									l2 |= 2;
								}
								if (l2 == 3) {
									break;
								}
							}

							if (l2 == 3) {
								CameraModel q2 = ln[kn];
								q2.hfb = h1;
								q2.ifb = i1;
								ri(kn);
								int k9;
								if (q2.nfb < 0) {
									k9 = h1.ug[i1];
								} else {
									k9 = h1.vg[i1];
								}
								if (k9 != 0xbc614e) {
									int i3 = 0;
									for (int k10 = 0; k10 < k4; k10++) {
										i3 += h1.mg[ai2[k10]];
									}

									int k3;
									q2.jfb = k3 = i3 / k4 + h1.dh;
									q2.overlay = k9;
									kn++;
								}
							}
						}
					}
				}

			}
		}

		Model h2 = vn;
		if (h2.fh) {
			for (int j1 = 0; j1 < h2.rg; j1++) {
				int ai1[] = h2.tg[j1];
				int i5 = ai1[0];
				int k5 = h2.ng[i5];
				int k6 = h2.og[i5];
				int l7 = h2.mg[i5];
				if (l7 > cm && l7 < zoom2) {
					int l8 = (sn[j1] << ym) / l7;
					int l9 = (tn[j1] << ym) / l7;
					if (k5 - l8 / 2 <= um && k5 + l8 / 2 >= -um
							&& k6 - l9 <= vm && k6 >= -vm) {
						CameraModel q3 = ln[kn];
						q3.hfb = h2;
						q3.ifb = j1;
						ti(kn);
						q3.jfb = (l7 + h2.mg[ai1[1]]) / 2;
						kn++;
					}
				}
			}

		}
		if (kn == 0) {
			return;
		}
		bm = kn;
		kh(ln, 0, kn - 1);
		bh(100, ln, kn);
		for (int l4 = 0; l4 < kn; l4++) {
			CameraModel q1 = ln[l4];
			Model h3 = q1.hfb;
			int k1 = q1.ifb;
			if (h3 == vn) {
				int ai3[] = h3.tg[k1];
				int l6 = ai3[0];
				int i8 = h3.ng[l6];
				int i9 = h3.og[l6];
				int i10 = h3.mg[l6];
				int l10 = (sn[k1] << ym) / i10;
				int j11 = (tn[k1] << ym) / i10;
				int l11 = i9 - h3.og[ai3[1]];
				int i12 = ((h3.ng[ai3[1]] - i8) * l11) / j11;
				i12 = h3.ng[ai3[1]] - i8;
				int k12 = i8 - l10 / 2;
				int i13 = (xm + i9) - j11;
				no.yf(k12 + wm, i13, l10, j11, on[k1], i12, (256 << ym) / i10);
				if (mm && pm < qm) {
					k12 += (un[k1] << ym) / i10;
					if (om >= i13 && om <= i13 + j11 && nm >= k12
							&& nm <= k12 + l10 && !h3.vh && h3.rh[k1] == 0) {
						rm[pm] = h3;
						sm[pm] = k1;
						pm++;
					}
				}
			} else {
				int j9 = 0;
				int i11 = 0;
				int k11 = h3.sg[k1];
				int ai4[] = h3.tg[k1];
				if (h3.yg[k1] != 0xbc614e) {
					if (q1.nfb < 0) {
						i11 = h3.oj - h3.yg[k1];
					} else {
						i11 = h3.oj + h3.yg[k1];
					}
				}
				for (int j12 = 0; j12 < k11; j12++) {
					int j3 = ai4[j12];
					vo[j12] = h3.kg[j3];
					wo[j12] = h3.lg[j3];
					xo[j12] = h3.mg[j3];
					if (h3.yg[k1] == 0xbc614e) {
						if (q1.nfb < 0) {
							i11 = (h3.oj - h3.pg[j3]) + h3.qg[j3];
						} else {
							i11 = h3.oj + h3.pg[j3] + h3.qg[j3];
						}
					}
					if (h3.mg[j3] >= cm) {
						so[j9] = h3.ng[j3];
						to[j9] = h3.og[j3];
						uo[j9] = i11;
						if (h3.mg[j3] > zoom4) {
							uo[j9] += (h3.mg[j3] - zoom4) / zoom3;
						}
						j9++;
					} else {
						int j10;
						if (j12 == 0) {
							j10 = ai4[k11 - 1];
						} else {
							j10 = ai4[j12 - 1];
						}
						if (h3.mg[j10] >= cm) {
							int j8 = h3.mg[j3] - h3.mg[j10];
							int l5 = h3.kg[j3]
									- ((h3.kg[j3] - h3.kg[j10]) * (h3.mg[j3] - cm))
									/ j8;
							int i7 = h3.lg[j3]
									- ((h3.lg[j3] - h3.lg[j10]) * (h3.mg[j3] - cm))
									/ j8;
							so[j9] = (l5 << ym) / cm;
							to[j9] = (i7 << ym) / cm;
							uo[j9] = i11;
							j9++;
						}
						if (j12 == k11 - 1) {
							j10 = ai4[0];
						} else {
							j10 = ai4[j12 + 1];
						}
						if (h3.mg[j10] >= cm) {
							int k8 = h3.mg[j3] - h3.mg[j10];
							int i6 = h3.kg[j3]
									- ((h3.kg[j3] - h3.kg[j10]) * (h3.mg[j3] - cm))
									/ k8;
							int j7 = h3.lg[j3]
									- ((h3.lg[j3] - h3.lg[j10]) * (h3.mg[j3] - cm))
									/ k8;
							so[j9] = (i6 << ym) / cm;
							to[j9] = (j7 << ym) / cm;
							uo[j9] = i11;
							j9++;
						}
					}
				}

				for (int l12 = 0; l12 < k11; l12++) {
					if (uo[l12] < 0) {
						uo[l12] = 0;
					} else if (uo[l12] > 255) {
						uo[l12] = 255;
					}
					if (q1.overlay >= 0) {
						if (_flddo[q1.overlay] == 1) {
							uo[l12] <<= 9;
						} else {
							uo[l12] <<= 6;
						}
					}
				}

				zg(0, 0, 0, 0, j9, so, to, uo, h3, k1);
				if (ro > qo) {
					jh(0, 0, k11, vo, wo, xo, q1.overlay, h3);
				}
			}
		}

		mm = false;
	}

	private void zg(int arg0, int arg1, int arg2, int arg3, int arg4,
			int arg5[], int arg6[], int arg7[], Model arg8, int arg9) {
		if (arg4 == 3) {
			int l = arg6[0] + xm;
			int l1 = arg6[1] + xm;
			int l2 = arg6[2] + xm;
			int l3 = arg5[0];
			int i5 = arg5[1];
			int k6 = arg5[2];
			int i8 = arg7[0];
			int k9 = arg7[1];
			int k10 = arg7[2];
			int k11 = (xm + vm) - 1;
			int i12 = 0;
			int k12 = 0;
			int i13 = 0;
			int k13 = 0;
			int i14 = 0xbc614e;
			int k14 = 0xff439eb2;
			if (l2 != l) {
				k12 = (k6 - l3 << 8) / (l2 - l);
				k13 = (k10 - i8 << 8) / (l2 - l);
				if (l < l2) {
					i12 = l3 << 8;
					i13 = i8 << 8;
					i14 = l;
					k14 = l2;
				} else {
					i12 = k6 << 8;
					i13 = k10 << 8;
					i14 = l2;
					k14 = l;
				}
				if (i14 < 0) {
					i12 -= k12 * i14;
					i13 -= k13 * i14;
					i14 = 0;
				}
				if (k14 > k11) {
					k14 = k11;
				}
			}
			int i15 = 0;
			int k15 = 0;
			int i16 = 0;
			int k16 = 0;
			int i17 = 0xbc614e;
			int k17 = 0xff439eb2;
			if (l1 != l) {
				k15 = (i5 - l3 << 8) / (l1 - l);
				k16 = (k9 - i8 << 8) / (l1 - l);
				if (l < l1) {
					i15 = l3 << 8;
					i16 = i8 << 8;
					i17 = l;
					k17 = l1;
				} else {
					i15 = i5 << 8;
					i16 = k9 << 8;
					i17 = l1;
					k17 = l;
				}
				if (i17 < 0) {
					i15 -= k15 * i17;
					i16 -= k16 * i17;
					i17 = 0;
				}
				if (k17 > k11) {
					k17 = k11;
				}
			}
			int i18 = 0;
			int k18 = 0;
			int i19 = 0;
			int k19 = 0;
			int i20 = 0xbc614e;
			int k20 = 0xff439eb2;
			if (l2 != l1) {
				k18 = (k6 - i5 << 8) / (l2 - l1);
				k19 = (k10 - k9 << 8) / (l2 - l1);
				if (l1 < l2) {
					i18 = i5 << 8;
					i19 = k9 << 8;
					i20 = l1;
					k20 = l2;
				} else {
					i18 = k6 << 8;
					i19 = k10 << 8;
					i20 = l2;
					k20 = l1;
				}
				if (i20 < 0) {
					i18 -= k18 * i20;
					i19 -= k19 * i20;
					i20 = 0;
				}
				if (k20 > k11) {
					k20 = k11;
				}
			}
			qo = i14;
			if (i17 < qo) {
				qo = i17;
			}
			if (i20 < qo) {
				qo = i20;
			}
			ro = k14;
			if (k17 > ro) {
				ro = k17;
			}
			if (k20 > ro) {
				ro = k20;
			}
			int i21 = 0;
			for (arg2 = qo; arg2 < ro; arg2++) {
				if (arg2 >= i14 && arg2 < k14) {
					arg0 = arg1 = i12;
					arg3 = i21 = i13;
					i12 += k12;
					i13 += k13;
				} else {
					arg0 = 0xa0000;
					arg1 = 0xfff60000;
				}
				if (arg2 >= i17 && arg2 < k17) {
					if (i15 < arg0) {
						arg0 = i15;
						arg3 = i16;
					}
					if (i15 > arg1) {
						arg1 = i15;
						i21 = i16;
					}
					i15 += k15;
					i16 += k16;
				}
				if (arg2 >= i20 && arg2 < k20) {
					if (i18 < arg0) {
						arg0 = i18;
						arg3 = i19;
					}
					if (i18 > arg1) {
						arg1 = i18;
						i21 = i19;
					}
					i18 += k18;
					i19 += k19;
				}
				CameraVariables s7 = po[arg2];
				s7.leftX = arg0;
				s7.rightX = arg1;
				s7.leftY = arg3;
				s7.rightY = i21;
			}

			if (qo < xm - vm) {
				qo = xm - vm;
			}
		} else if (arg4 == 4) {
			int i1 = arg6[0] + xm;
			int i2 = arg6[1] + xm;
			int i3 = arg6[2] + xm;
			int i4 = arg6[3] + xm;
			int j5 = arg5[0];
			int l6 = arg5[1];
			int j8 = arg5[2];
			int l9 = arg5[3];
			int l10 = arg7[0];
			int l11 = arg7[1];
			int j12 = arg7[2];
			int l12 = arg7[3];
			int j13 = (xm + vm) - 1;
			int l13 = 0;
			int j14 = 0;
			int l14 = 0;
			int j15 = 0;
			int l15 = 0xbc614e;
			int j16 = 0xff439eb2;
			if (i4 != i1) {
				j14 = (l9 - j5 << 8) / (i4 - i1);
				j15 = (l12 - l10 << 8) / (i4 - i1);
				if (i1 < i4) {
					l13 = j5 << 8;
					l14 = l10 << 8;
					l15 = i1;
					j16 = i4;
				} else {
					l13 = l9 << 8;
					l14 = l12 << 8;
					l15 = i4;
					j16 = i1;
				}
				if (l15 < 0) {
					l13 -= j14 * l15;
					l14 -= j15 * l15;
					l15 = 0;
				}
				if (j16 > j13) {
					j16 = j13;
				}
			}
			int l16 = 0;
			int j17 = 0;
			int l17 = 0;
			int j18 = 0;
			int l18 = 0xbc614e;
			int j19 = 0xff439eb2;
			if (i2 != i1) {
				j17 = (l6 - j5 << 8) / (i2 - i1);
				j18 = (l11 - l10 << 8) / (i2 - i1);
				if (i1 < i2) {
					l16 = j5 << 8;
					l17 = l10 << 8;
					l18 = i1;
					j19 = i2;
				} else {
					l16 = l6 << 8;
					l17 = l11 << 8;
					l18 = i2;
					j19 = i1;
				}
				if (l18 < 0) {
					l16 -= j17 * l18;
					l17 -= j18 * l18;
					l18 = 0;
				}
				if (j19 > j13) {
					j19 = j13;
				}
			}
			int l19 = 0;
			int j20 = 0;
			int l20 = 0;
			int j21 = 0;
			int k21 = 0xbc614e;
			int l21 = 0xff439eb2;
			if (i3 != i2) {
				j20 = (j8 - l6 << 8) / (i3 - i2);
				j21 = (j12 - l11 << 8) / (i3 - i2);
				if (i2 < i3) {
					l19 = l6 << 8;
					l20 = l11 << 8;
					k21 = i2;
					l21 = i3;
				} else {
					l19 = j8 << 8;
					l20 = j12 << 8;
					k21 = i3;
					l21 = i2;
				}
				if (k21 < 0) {
					l19 -= j20 * k21;
					l20 -= j21 * k21;
					k21 = 0;
				}
				if (l21 > j13) {
					l21 = j13;
				}
			}
			int i22 = 0;
			int j22 = 0;
			int k22 = 0;
			int l22 = 0;
			int i23 = 0xbc614e;
			int j23 = 0xff439eb2;
			if (i4 != i3) {
				j22 = (l9 - j8 << 8) / (i4 - i3);
				l22 = (l12 - j12 << 8) / (i4 - i3);
				if (i3 < i4) {
					i22 = j8 << 8;
					k22 = j12 << 8;
					i23 = i3;
					j23 = i4;
				} else {
					i22 = l9 << 8;
					k22 = l12 << 8;
					i23 = i4;
					j23 = i3;
				}
				if (i23 < 0) {
					i22 -= j22 * i23;
					k22 -= l22 * i23;
					i23 = 0;
				}
				if (j23 > j13) {
					j23 = j13;
				}
			}
			qo = l15;
			if (l18 < qo) {
				qo = l18;
			}
			if (k21 < qo) {
				qo = k21;
			}
			if (i23 < qo) {
				qo = i23;
			}
			ro = j16;
			if (j19 > ro) {
				ro = j19;
			}
			if (l21 > ro) {
				ro = l21;
			}
			if (j23 > ro) {
				ro = j23;
			}
			int k23 = 0;
			for (arg2 = qo; arg2 < ro; arg2++) {
				if (arg2 >= l15 && arg2 < j16) {
					arg0 = arg1 = l13;
					arg3 = k23 = l14;
					l13 += j14;
					l14 += j15;
				} else {
					arg0 = 0xa0000;
					arg1 = 0xfff60000;
				}
				if (arg2 >= l18 && arg2 < j19) {
					if (l16 < arg0) {
						arg0 = l16;
						arg3 = l17;
					}
					if (l16 > arg1) {
						arg1 = l16;
						k23 = l17;
					}
					l16 += j17;
					l17 += j18;
				}
				if (arg2 >= k21 && arg2 < l21) {
					if (l19 < arg0) {
						arg0 = l19;
						arg3 = l20;
					}
					if (l19 > arg1) {
						arg1 = l19;
						k23 = l20;
					}
					l19 += j20;
					l20 += j21;
				}
				if (arg2 >= i23 && arg2 < j23) {
					if (i22 < arg0) {
						arg0 = i22;
						arg3 = k22;
					}
					if (i22 > arg1) {
						arg1 = i22;
						k23 = k22;
					}
					i22 += j22;
					k22 += l22;
				}
				CameraVariables s8 = po[arg2];
				s8.leftX = arg0;
				s8.rightX = arg1;
				s8.leftY = arg3;
				s8.rightY = k23;
			}

			if (qo < xm - vm) {
				qo = xm - vm;
			}
		} else {
			ro = qo = arg6[0] += xm;
			for (arg2 = 1; arg2 < arg4; arg2++) {
				int j1;
				if ((j1 = arg6[arg2] += xm) < qo) {
					qo = j1;
				} else if (j1 > ro) {
					ro = j1;
				}
			}

			if (qo < xm - vm) {
				qo = xm - vm;
			}
			if (ro >= xm + vm) {
				ro = (xm + vm) - 1;
			}
			if (qo >= ro) {
				return;
			}
			for (arg2 = qo; arg2 < ro; arg2++) {
				CameraVariables s1 = po[arg2];
				s1.leftX = 0xa0000;
				s1.rightX = 0xfff60000;
			}

			int k1 = arg4 - 1;
			int j2 = arg6[0];
			int j3 = arg6[k1];
			if (j2 < j3) {
				int j4 = arg5[0] << 8;
				int k5 = (arg5[k1] - arg5[0] << 8) / (j3 - j2);
				int i7 = arg7[0] << 8;
				int k8 = (arg7[k1] - arg7[0] << 8) / (j3 - j2);
				if (j2 < 0) {
					j4 -= k5 * j2;
					i7 -= k8 * j2;
					j2 = 0;
				}
				if (j3 > ro) {
					j3 = ro;
				}
				for (arg2 = j2; arg2 <= j3; arg2++) {
					CameraVariables s3 = po[arg2];
					s3.leftX = s3.rightX = j4;
					s3.leftY = s3.rightY = i7;
					j4 += k5;
					i7 += k8;
				}

			} else if (j2 > j3) {
				int k4 = arg5[k1] << 8;
				int l5 = (arg5[0] - arg5[k1] << 8) / (j2 - j3);
				int j7 = arg7[k1] << 8;
				int l8 = (arg7[0] - arg7[k1] << 8) / (j2 - j3);
				if (j3 < 0) {
					k4 -= l5 * j3;
					j7 -= l8 * j3;
					j3 = 0;
				}
				if (j2 > ro) {
					j2 = ro;
				}
				for (arg2 = j3; arg2 <= j2; arg2++) {
					CameraVariables s4 = po[arg2];
					s4.leftX = s4.rightX = k4;
					s4.leftY = s4.rightY = j7;
					k4 += l5;
					j7 += l8;
				}

			}
			for (arg2 = 0; arg2 < k1; arg2++) {
				int l4 = arg2 + 1;
				int k2 = arg6[arg2];
				int k3 = arg6[l4];
				if (k2 < k3) {
					int i6 = arg5[arg2] << 8;
					int k7 = (arg5[l4] - arg5[arg2] << 8) / (k3 - k2);
					int i9 = arg7[arg2] << 8;
					int i10 = (arg7[l4] - arg7[arg2] << 8) / (k3 - k2);
					if (k2 < 0) {
						i6 -= k7 * k2;
						i9 -= i10 * k2;
						k2 = 0;
					}
					if (k3 > ro) {
						k3 = ro;
					}
					for (int i11 = k2; i11 <= k3; i11++) {
						CameraVariables s5 = po[i11];
						if (i6 < s5.leftX) {
							s5.leftX = i6;
							s5.leftY = i9;
						}
						if (i6 > s5.rightX) {
							s5.rightX = i6;
							s5.rightY = i9;
						}
						i6 += k7;
						i9 += i10;
					}

				} else if (k2 > k3) {
					int j6 = arg5[l4] << 8;
					int l7 = (arg5[arg2] - arg5[l4] << 8) / (k2 - k3);
					int j9 = arg7[l4] << 8;
					int j10 = (arg7[arg2] - arg7[l4] << 8) / (k2 - k3);
					if (k3 < 0) {
						j6 -= l7 * k3;
						j9 -= j10 * k3;
						k3 = 0;
					}
					if (k2 > ro) {
						k2 = ro;
					}
					for (int j11 = k3; j11 <= k2; j11++) {
						CameraVariables s6 = po[j11];
						if (j6 < s6.leftX) {
							s6.leftX = j6;
							s6.leftY = j9;
						}
						if (j6 > s6.rightX) {
							s6.rightX = j6;
							s6.rightY = j9;
						}
						j6 += l7;
						j9 += j10;
					}

				}
			}

			if (qo < xm - vm) {
				qo = xm - vm;
			}
		}
		if (mm && pm < qm && om >= qo && om < ro) {
			CameraVariables s2 = po[om];
			if (nm >= s2.leftX >> 8 && nm <= s2.rightX >> 8 && s2.leftX <= s2.rightX
					&& !arg8.vh && arg8.rh[arg9] == 0) {
				rm[pm] = arg8;
				sm[pm] = arg9;
				pm++;
			}
		}
	}

	private void jh(int arg0, int arg1, int arg2, int arg3[], int arg4[],
			int arg5[], int arg6, Model arg7) {
		if (arg6 >= 0) {
			if (arg6 >= ao) {
				arg6 = 0;
			}
			fi(arg6);
			int l = arg3[0];
			int j1 = arg4[0];
			int i2 = arg5[0];
			int l2 = l - arg3[1];
			int j3 = j1 - arg4[1];
			int l3 = i2 - arg5[1];
			arg2--;
			int l5 = arg3[arg2] - l;
			int i7 = arg4[arg2] - j1;
			int j8 = arg5[arg2] - i2;
			if (_flddo[arg6] == 1) {
				int k9 = l5 * j1 - i7 * l << 12;
				int j10 = i7 * i2 - j8 * j1 << (5 - ym) + 7 + 4;
				int l10 = j8 * l - l5 * i2 << (5 - ym) + 7;
				int j11 = l2 * j1 - j3 * l << 12;
				int l11 = j3 * i2 - l3 * j1 << (5 - ym) + 7 + 4;
				int j12 = l3 * l - l2 * i2 << (5 - ym) + 7;
				int l12 = j3 * l5 - l2 * i7 << 5;
				int j13 = l3 * i7 - j3 * j8 << (5 - ym) + 4;
				int l13 = l2 * j8 - l3 * l5 >> ym - 5;
				int j14 = j10 >> 4;
				int l14 = l11 >> 4;
				int j15 = j13 >> 4;
				int l15 = qo - xm;
				int j16 = tm;
				int l16 = wm + qo * j16;
				byte byte1 = 1;
				k9 += l10 * l15;
				j11 += j12 * l15;
				l12 += l13 * l15;
				if (yo) {
					if ((qo & 1) == 1) {
						qo++;
						k9 += l10;
						j11 += j12;
						l12 += l13;
						l16 += j16;
					}
					l10 <<= 1;
					j12 <<= 1;
					l13 <<= 1;
					j16 <<= 1;
					byte1 = 2;
				}
				if (arg7.nh) {
					for (arg0 = qo; arg0 < ro; arg0 += byte1) {
						CameraVariables s4 = po[arg0];
						arg1 = s4.leftX >> 8;
						int j17 = s4.rightX >> 8;
						int j20 = j17 - arg1;
						if (j20 <= 0) {
							k9 += l10;
							j11 += j12;
							l12 += l13;
							l16 += j16;
						} else {
							int l21 = s4.leftY;
							int j23 = (s4.rightY - l21) / j20;
							if (arg1 < -um) {
								l21 += (-um - arg1) * j23;
								arg1 = -um;
								j20 = j17 - arg1;
							}
							if (j17 > um) {
								int k17 = um;
								j20 = k17 - arg1;
							}
							ji(oo, go[arg6], 0, 0, k9 + j14 * arg1, j11 + l14
									* arg1, l12 + j15 * arg1, j10, l11, j13,
									j20, l16 + arg1, l21, j23 << 2);
							k9 += l10;
							j11 += j12;
							l12 += l13;
							l16 += j16;
						}
					}

					return;
				}
				if (!fo[arg6]) {
					for (arg0 = qo; arg0 < ro; arg0 += byte1) {
						CameraVariables s5 = po[arg0];
						arg1 = s5.leftX >> 8;
						int l17 = s5.rightX >> 8;
						int k20 = l17 - arg1;
						if (k20 <= 0) {
							k9 += l10;
							j11 += j12;
							l12 += l13;
							l16 += j16;
						} else {
							int i22 = s5.leftY;
							int k23 = (s5.rightY - i22) / k20;
							if (arg1 < -um) {
								i22 += (-um - arg1) * k23;
								arg1 = -um;
								k20 = l17 - arg1;
							}
							if (l17 > um) {
								int i18 = um;
								k20 = i18 - arg1;
							}
							nh(oo, go[arg6], 0, 0, k9 + j14 * arg1, j11 + l14
									* arg1, l12 + j15 * arg1, j10, l11, j13,
									k20, l16 + arg1, i22, k23 << 2);
							k9 += l10;
							j11 += j12;
							l12 += l13;
							l16 += j16;
						}
					}

					return;
				}
				for (arg0 = qo; arg0 < ro; arg0 += byte1) {
					CameraVariables s6 = po[arg0];
					arg1 = s6.leftX >> 8;
					int j18 = s6.rightX >> 8;
					int l20 = j18 - arg1;
					if (l20 <= 0) {
						k9 += l10;
						j11 += j12;
						l12 += l13;
						l16 += j16;
					} else {
						int j22 = s6.leftY;
						int l23 = (s6.rightY - j22) / l20;
						if (arg1 < -um) {
							j22 += (-um - arg1) * l23;
							arg1 = -um;
							l20 = j18 - arg1;
						}
						if (j18 > um) {
							int k18 = um;
							l20 = k18 - arg1;
						}
						ci(oo, 0, 0, 0, go[arg6], k9 + j14 * arg1, j11 + l14
								* arg1, l12 + j15 * arg1, j10, l11, j13, l20,
								l16 + arg1, j22, l23);
						k9 += l10;
						j11 += j12;
						l12 += l13;
						l16 += j16;
					}
				}

				return;
			}
			int l9 = l5 * j1 - i7 * l << 11;
			int k10 = i7 * i2 - j8 * j1 << (5 - ym) + 6 + 4;
			int i11 = j8 * l - l5 * i2 << (5 - ym) + 6;
			int k11 = l2 * j1 - j3 * l << 11;
			int i12 = j3 * i2 - l3 * j1 << (5 - ym) + 6 + 4;
			int k12 = l3 * l - l2 * i2 << (5 - ym) + 6;
			int i13 = j3 * l5 - l2 * i7 << 5;
			int k13 = l3 * i7 - j3 * j8 << (5 - ym) + 4;
			int i14 = l2 * j8 - l3 * l5 >> ym - 5;
			int k14 = k10 >> 4;
			int i15 = i12 >> 4;
			int k15 = k13 >> 4;
			int i16 = qo - xm;
			int k16 = tm;
			int i17 = wm + qo * k16;
			byte byte2 = 1;
			l9 += i11 * i16;
			k11 += k12 * i16;
			i13 += i14 * i16;
			if (yo) {
				if ((qo & 1) == 1) {
					qo++;
					l9 += i11;
					k11 += k12;
					i13 += i14;
					i17 += k16;
				}
				i11 <<= 1;
				k12 <<= 1;
				i14 <<= 1;
				k16 <<= 1;
				byte2 = 2;
			}
			if (arg7.nh) {
				for (arg0 = qo; arg0 < ro; arg0 += byte2) {
					CameraVariables s7 = po[arg0];
					arg1 = s7.leftX >> 8;
					int l18 = s7.rightX >> 8;
					int i21 = l18 - arg1;
					if (i21 <= 0) {
						l9 += i11;
						k11 += k12;
						i13 += i14;
						i17 += k16;
					} else {
						int k22 = s7.leftY;
						int i24 = (s7.rightY - k22) / i21;
						if (arg1 < -um) {
							k22 += (-um - arg1) * i24;
							arg1 = -um;
							i21 = l18 - arg1;
						}
						if (l18 > um) {
							int i19 = um;
							i21 = i19 - arg1;
						}
						qh(oo, go[arg6], 0, 0, l9 + k14 * arg1, k11 + i15
								* arg1, i13 + k15 * arg1, k10, i12, k13, i21,
								i17 + arg1, k22, i24);
						l9 += i11;
						k11 += k12;
						i13 += i14;
						i17 += k16;
					}
				}

				return;
			}
			if (!fo[arg6]) {
				for (arg0 = qo; arg0 < ro; arg0 += byte2) {
					CameraVariables s8 = po[arg0];
					arg1 = s8.leftX >> 8;
					int j19 = s8.rightX >> 8;
					int j21 = j19 - arg1;
					if (j21 <= 0) {
						l9 += i11;
						k11 += k12;
						i13 += i14;
						i17 += k16;
					} else {
						int l22 = s8.leftY;
						int j24 = (s8.rightY - l22) / j21;
						if (arg1 < -um) {
							l22 += (-um - arg1) * j24;
							arg1 = -um;
							j21 = j19 - arg1;
						}
						if (j19 > um) {
							int k19 = um;
							j21 = k19 - arg1;
						}
						ki(oo, go[arg6], 0, 0, l9 + k14 * arg1, k11 + i15
								* arg1, i13 + k15 * arg1, k10, i12, k13, j21,
								i17 + arg1, l22, j24);
						l9 += i11;
						k11 += k12;
						i13 += i14;
						i17 += k16;
					}
				}

				return;
			}
			for (arg0 = qo; arg0 < ro; arg0 += byte2) {
				CameraVariables s9 = po[arg0];
				arg1 = s9.leftX >> 8;
				int l19 = s9.rightX >> 8;
				int k21 = l19 - arg1;
				if (k21 <= 0) {
					l9 += i11;
					k11 += k12;
					i13 += i14;
					i17 += k16;
				} else {
					int i23 = s9.leftY;
					int k24 = (s9.rightY - i23) / k21;
					if (arg1 < -um) {
						i23 += (-um - arg1) * k24;
						arg1 = -um;
						k21 = l19 - arg1;
					}
					if (l19 > um) {
						int i20 = um;
						k21 = i20 - arg1;
					}
					mh(oo, 0, 0, 0, go[arg6], l9 + k14 * arg1,
							k11 + i15 * arg1, i13 + k15 * arg1, k10, i12, k13,
							k21, i17 + arg1, i23, k24);
					l9 += i11;
					k11 += k12;
					i13 += i14;
					i17 += k16;
				}
			}

			return;
		}
		for (int i1 = 0; i1 < xl; i1++) {
			if (yl[i1] == arg6) {
				am = zl[i1];
				break;
			}
			if (i1 == xl - 1) {
				int k1 = (int) (Math.random() * (double) xl);
				yl[k1] = arg6;
				arg6 = -1 - arg6;
				int j2 = (arg6 >> 10 & 0x1f) * 8;
				int i3 = (arg6 >> 5 & 0x1f) * 8;
				int k3 = (arg6 & 0x1f) * 8;
				for (int i4 = 0; i4 < 256; i4++) {
					int i6 = i4 * i4;
					int j7 = (j2 * i6) / 0x10000;
					int k8 = (i3 * i6) / 0x10000;
					int i10 = (k3 * i6) / 0x10000;
					zl[k1][255 - i4] = (j7 << 16) + (k8 << 8) + i10;
				}

				am = zl[k1];
			}
		}

		int l1 = tm;
		int k2 = wm + qo * l1;
		byte byte0 = 1;
		if (yo) {
			if ((qo & 1) == 1) {
				qo++;
				k2 += l1;
			}
			l1 <<= 1;
			byte0 = 2;
		}
		if (arg7.oh) {
			for (arg0 = qo; arg0 < ro; arg0 += byte0) {
				CameraVariables s1 = po[arg0];
				arg1 = s1.leftX >> 8;
				int j4 = s1.rightX >> 8;
				int j6 = j4 - arg1;
				if (j6 <= 0) {
					k2 += l1;
				} else {
					int k7 = s1.leftY;
					int l8 = (s1.rightY - k7) / j6;
					if (arg1 < -um) {
						k7 += (-um - arg1) * l8;
						arg1 = -um;
						j6 = j4 - arg1;
					}
					if (j4 > um) {
						int k4 = um;
						j6 = k4 - arg1;
					}
					bi(oo, -j6, k2 + arg1, 0, am, k7, l8);
					k2 += l1;
				}
			}

			return;
		}
		if (jm) {
			for (arg0 = qo; arg0 < ro; arg0 += byte0) {
				CameraVariables s2 = po[arg0];
				arg1 = s2.leftX >> 8;
				int l4 = s2.rightX >> 8;
				int k6 = l4 - arg1;
				if (k6 <= 0) {
					k2 += l1;
				} else {
					int l7 = s2.leftY;
					int i9 = (s2.rightY - l7) / k6;
					if (arg1 < -um) {
						l7 += (-um - arg1) * i9;
						arg1 = -um;
						k6 = l4 - arg1;
					}
					if (l4 > um) {
						int i5 = um;
						k6 = i5 - arg1;
					}
					dh(oo, -k6, k2 + arg1, 0, am, l7, i9);
					k2 += l1;
				}
			}

			return;
		}
		for (arg0 = qo; arg0 < ro; arg0 += byte0) {
			CameraVariables s3 = po[arg0];
			arg1 = s3.leftX >> 8;
			int j5 = s3.rightX >> 8;
			int l6 = j5 - arg1;
			if (l6 <= 0) {
				k2 += l1;
			} else {
				int i8 = s3.leftY;
				int j9 = (s3.rightY - i8) / l6;
				if (arg1 < -um) {
					i8 += (-um - arg1) * j9;
					arg1 = -um;
					l6 = j5 - arg1;
				}
				if (j5 > um) {
					int k5 = um;
					l6 = k5 - arg1;
				}
				rh(oo, -l6, k2 + arg1, 0, am, i8, j9);
				k2 += l1;
			}
		}

	}

	private static void nh(int arg0[], int arg1[], int arg2, int arg3,
			int arg4, int arg5, int arg6, int arg7, int arg8, int arg9,
			int arg10, int arg11, int arg12, int arg13) {
		if (arg10 <= 0) {
			return;
		}
		int l = 0;
		int i1 = 0;
		int l1 = 0;
		if (arg6 != 0) {
			arg2 = arg4 / arg6 << 7;
			arg3 = arg5 / arg6 << 7;
		}
		if (arg2 < 0) {
			arg2 = 0;
		} else if (arg2 > 16256) {
			arg2 = 16256;
		}
		arg4 += arg7;
		arg5 += arg8;
		arg6 += arg9;
		if (arg6 != 0) {
			l = arg4 / arg6 << 7;
			i1 = arg5 / arg6 << 7;
		}
		if (l < 0) {
			l = 0;
		} else if (l > 16256) {
			l = 16256;
		}
		int j1 = l - arg2 >> 4;
		int k1 = i1 - arg3 >> 4;
		for (int i2 = arg10 >> 4; i2 > 0; i2--) {
			arg2 += arg12 & 0x600000;
			l1 = arg12 >> 23;
			arg12 += arg13;
			arg0[arg11++] = arg1[(arg3 & 0x3f80) + (arg2 >> 7)] >>> l1;
			arg2 += j1;
			arg3 += k1;
			arg0[arg11++] = arg1[(arg3 & 0x3f80) + (arg2 >> 7)] >>> l1;
			arg2 += j1;
			arg3 += k1;
			arg0[arg11++] = arg1[(arg3 & 0x3f80) + (arg2 >> 7)] >>> l1;
			arg2 += j1;
			arg3 += k1;
			arg0[arg11++] = arg1[(arg3 & 0x3f80) + (arg2 >> 7)] >>> l1;
			arg2 += j1;
			arg3 += k1;
			arg2 = (arg2 & 0x3fff) + (arg12 & 0x600000);
			l1 = arg12 >> 23;
			arg12 += arg13;
			arg0[arg11++] = arg1[(arg3 & 0x3f80) + (arg2 >> 7)] >>> l1;
			arg2 += j1;
			arg3 += k1;
			arg0[arg11++] = arg1[(arg3 & 0x3f80) + (arg2 >> 7)] >>> l1;
			arg2 += j1;
			arg3 += k1;
			arg0[arg11++] = arg1[(arg3 & 0x3f80) + (arg2 >> 7)] >>> l1;
			arg2 += j1;
			arg3 += k1;
			arg0[arg11++] = arg1[(arg3 & 0x3f80) + (arg2 >> 7)] >>> l1;
			arg2 += j1;
			arg3 += k1;
			arg2 = (arg2 & 0x3fff) + (arg12 & 0x600000);
			l1 = arg12 >> 23;
			arg12 += arg13;
			arg0[arg11++] = arg1[(arg3 & 0x3f80) + (arg2 >> 7)] >>> l1;
			arg2 += j1;
			arg3 += k1;
			arg0[arg11++] = arg1[(arg3 & 0x3f80) + (arg2 >> 7)] >>> l1;
			arg2 += j1;
			arg3 += k1;
			arg0[arg11++] = arg1[(arg3 & 0x3f80) + (arg2 >> 7)] >>> l1;
			arg2 += j1;
			arg3 += k1;
			arg0[arg11++] = arg1[(arg3 & 0x3f80) + (arg2 >> 7)] >>> l1;
			arg2 += j1;
			arg3 += k1;
			arg2 = (arg2 & 0x3fff) + (arg12 & 0x600000);
			l1 = arg12 >> 23;
			arg12 += arg13;
			arg0[arg11++] = arg1[(arg3 & 0x3f80) + (arg2 >> 7)] >>> l1;
			arg2 += j1;
			arg3 += k1;
			arg0[arg11++] = arg1[(arg3 & 0x3f80) + (arg2 >> 7)] >>> l1;
			arg2 += j1;
			arg3 += k1;
			arg0[arg11++] = arg1[(arg3 & 0x3f80) + (arg2 >> 7)] >>> l1;
			arg2 += j1;
			arg3 += k1;
			arg0[arg11++] = arg1[(arg3 & 0x3f80) + (arg2 >> 7)] >>> l1;
			arg2 = l;
			arg3 = i1;
			arg4 += arg7;
			arg5 += arg8;
			arg6 += arg9;
			if (arg6 != 0) {
				l = arg4 / arg6 << 7;
				i1 = arg5 / arg6 << 7;
			}
			if (l < 0) {
				l = 0;
			} else if (l > 16256) {
				l = 16256;
			}
			j1 = l - arg2 >> 4;
			k1 = i1 - arg3 >> 4;
		}

		for (int j2 = 0; j2 < (arg10 & 0xf); j2++) {
			if ((j2 & 3) == 0) {
				arg2 = (arg2 & 0x3fff) + (arg12 & 0x600000);
				l1 = arg12 >> 23;
				arg12 += arg13;
			}
			arg0[arg11++] = arg1[(arg3 & 0x3f80) + (arg2 >> 7)] >>> l1;
			arg2 += j1;
			arg3 += k1;
		}

	}

	private static void ji(int arg0[], int arg1[], int arg2, int arg3,
			int arg4, int arg5, int arg6, int arg7, int arg8, int arg9,
			int arg10, int arg11, int arg12, int arg13) {
		if (arg10 <= 0) {
			return;
		}
		int l = 0;
		int i1 = 0;
		int l1 = 0;
		if (arg6 != 0) {
			arg2 = arg4 / arg6 << 7;
			arg3 = arg5 / arg6 << 7;
		}
		if (arg2 < 0) {
			arg2 = 0;
		} else if (arg2 > 16256) {
			arg2 = 16256;
		}
		arg4 += arg7;
		arg5 += arg8;
		arg6 += arg9;
		if (arg6 != 0) {
			l = arg4 / arg6 << 7;
			i1 = arg5 / arg6 << 7;
		}
		if (l < 0) {
			l = 0;
		} else if (l > 16256) {
			l = 16256;
		}
		int j1 = l - arg2 >> 4;
		int k1 = i1 - arg3 >> 4;
		for (int i2 = arg10 >> 4; i2 > 0; i2--) {
			arg2 += arg12 & 0x600000;
			l1 = arg12 >> 23;
			arg12 += arg13;
			arg0[arg11++] = (arg1[(arg3 & 0x3f80) + (arg2 >> 7)] >>> l1)
					+ (arg0[arg11] >> 1 & 0x7f7f7f);
			arg2 += j1;
			arg3 += k1;
			arg0[arg11++] = (arg1[(arg3 & 0x3f80) + (arg2 >> 7)] >>> l1)
					+ (arg0[arg11] >> 1 & 0x7f7f7f);
			arg2 += j1;
			arg3 += k1;
			arg0[arg11++] = (arg1[(arg3 & 0x3f80) + (arg2 >> 7)] >>> l1)
					+ (arg0[arg11] >> 1 & 0x7f7f7f);
			arg2 += j1;
			arg3 += k1;
			arg0[arg11++] = (arg1[(arg3 & 0x3f80) + (arg2 >> 7)] >>> l1)
					+ (arg0[arg11] >> 1 & 0x7f7f7f);
			arg2 += j1;
			arg3 += k1;
			arg2 = (arg2 & 0x3fff) + (arg12 & 0x600000);
			l1 = arg12 >> 23;
			arg12 += arg13;
			arg0[arg11++] = (arg1[(arg3 & 0x3f80) + (arg2 >> 7)] >>> l1)
					+ (arg0[arg11] >> 1 & 0x7f7f7f);
			arg2 += j1;
			arg3 += k1;
			arg0[arg11++] = (arg1[(arg3 & 0x3f80) + (arg2 >> 7)] >>> l1)
					+ (arg0[arg11] >> 1 & 0x7f7f7f);
			arg2 += j1;
			arg3 += k1;
			arg0[arg11++] = (arg1[(arg3 & 0x3f80) + (arg2 >> 7)] >>> l1)
					+ (arg0[arg11] >> 1 & 0x7f7f7f);
			arg2 += j1;
			arg3 += k1;
			arg0[arg11++] = (arg1[(arg3 & 0x3f80) + (arg2 >> 7)] >>> l1)
					+ (arg0[arg11] >> 1 & 0x7f7f7f);
			arg2 += j1;
			arg3 += k1;
			arg2 = (arg2 & 0x3fff) + (arg12 & 0x600000);
			l1 = arg12 >> 23;
			arg12 += arg13;
			arg0[arg11++] = (arg1[(arg3 & 0x3f80) + (arg2 >> 7)] >>> l1)
					+ (arg0[arg11] >> 1 & 0x7f7f7f);
			arg2 += j1;
			arg3 += k1;
			arg0[arg11++] = (arg1[(arg3 & 0x3f80) + (arg2 >> 7)] >>> l1)
					+ (arg0[arg11] >> 1 & 0x7f7f7f);
			arg2 += j1;
			arg3 += k1;
			arg0[arg11++] = (arg1[(arg3 & 0x3f80) + (arg2 >> 7)] >>> l1)
					+ (arg0[arg11] >> 1 & 0x7f7f7f);
			arg2 += j1;
			arg3 += k1;
			arg0[arg11++] = (arg1[(arg3 & 0x3f80) + (arg2 >> 7)] >>> l1)
					+ (arg0[arg11] >> 1 & 0x7f7f7f);
			arg2 += j1;
			arg3 += k1;
			arg2 = (arg2 & 0x3fff) + (arg12 & 0x600000);
			l1 = arg12 >> 23;
			arg12 += arg13;
			arg0[arg11++] = (arg1[(arg3 & 0x3f80) + (arg2 >> 7)] >>> l1)
					+ (arg0[arg11] >> 1 & 0x7f7f7f);
			arg2 += j1;
			arg3 += k1;
			arg0[arg11++] = (arg1[(arg3 & 0x3f80) + (arg2 >> 7)] >>> l1)
					+ (arg0[arg11] >> 1 & 0x7f7f7f);
			arg2 += j1;
			arg3 += k1;
			arg0[arg11++] = (arg1[(arg3 & 0x3f80) + (arg2 >> 7)] >>> l1)
					+ (arg0[arg11] >> 1 & 0x7f7f7f);
			arg2 += j1;
			arg3 += k1;
			arg0[arg11++] = (arg1[(arg3 & 0x3f80) + (arg2 >> 7)] >>> l1)
					+ (arg0[arg11] >> 1 & 0x7f7f7f);
			arg2 = l;
			arg3 = i1;
			arg4 += arg7;
			arg5 += arg8;
			arg6 += arg9;
			if (arg6 != 0) {
				l = arg4 / arg6 << 7;
				i1 = arg5 / arg6 << 7;
			}
			if (l < 0) {
				l = 0;
			} else if (l > 16256) {
				l = 16256;
			}
			j1 = l - arg2 >> 4;
			k1 = i1 - arg3 >> 4;
		}

		for (int j2 = 0; j2 < (arg10 & 0xf); j2++) {
			if ((j2 & 3) == 0) {
				arg2 = (arg2 & 0x3fff) + (arg12 & 0x600000);
				l1 = arg12 >> 23;
				arg12 += arg13;
			}
			arg0[arg11++] = (arg1[(arg3 & 0x3f80) + (arg2 >> 7)] >>> l1)
					+ (arg0[arg11] >> 1 & 0x7f7f7f);
			arg2 += j1;
			arg3 += k1;
		}

	}

	private static void ci(int arg0[], int arg1, int arg2, int arg3,
			int arg4[], int arg5, int arg6, int arg7, int arg8, int arg9,
			int arg10, int arg11, int arg12, int arg13, int arg14) {
		if (arg11 <= 0) {
			return;
		}
		int l = 0;
		int i1 = 0;
		arg14 <<= 2;
		if (arg7 != 0) {
			l = arg5 / arg7 << 7;
			i1 = arg6 / arg7 << 7;
		}
		if (l < 0) {
			l = 0;
		} else if (l > 16256) {
			l = 16256;
		}
		for (int l1 = arg11; l1 > 0; l1 -= 16) {
			arg5 += arg8;
			arg6 += arg9;
			arg7 += arg10;
			arg2 = l;
			arg3 = i1;
			if (arg7 != 0) {
				l = arg5 / arg7 << 7;
				i1 = arg6 / arg7 << 7;
			}
			if (l < 0) {
				l = 0;
			} else if (l > 16256) {
				l = 16256;
			}
			int j1 = l - arg2 >> 4;
			int k1 = i1 - arg3 >> 4;
			int i2 = arg13 >> 23;
			arg2 += arg13 & 0x600000;
			arg13 += arg14;
			if (l1 < 16) {
				for (int j2 = 0; j2 < l1; j2++) {
					if ((arg1 = arg4[(arg3 & 0x3f80) + (arg2 >> 7)] >>> i2) != 0) {
						arg0[arg12] = arg1;
					}
					arg12++;
					arg2 += j1;
					arg3 += k1;
					if ((j2 & 3) == 3) {
						arg2 = (arg2 & 0x3fff) + (arg13 & 0x600000);
						i2 = arg13 >> 23;
						arg13 += arg14;
					}
				}

			} else {
				if ((arg1 = arg4[(arg3 & 0x3f80) + (arg2 >> 7)] >>> i2) != 0) {
					arg0[arg12] = arg1;
				}
				arg12++;
				arg2 += j1;
				arg3 += k1;
				if ((arg1 = arg4[(arg3 & 0x3f80) + (arg2 >> 7)] >>> i2) != 0) {
					arg0[arg12] = arg1;
				}
				arg12++;
				arg2 += j1;
				arg3 += k1;
				if ((arg1 = arg4[(arg3 & 0x3f80) + (arg2 >> 7)] >>> i2) != 0) {
					arg0[arg12] = arg1;
				}
				arg12++;
				arg2 += j1;
				arg3 += k1;
				if ((arg1 = arg4[(arg3 & 0x3f80) + (arg2 >> 7)] >>> i2) != 0) {
					arg0[arg12] = arg1;
				}
				arg12++;
				arg2 += j1;
				arg3 += k1;
				arg2 = (arg2 & 0x3fff) + (arg13 & 0x600000);
				i2 = arg13 >> 23;
				arg13 += arg14;
				if ((arg1 = arg4[(arg3 & 0x3f80) + (arg2 >> 7)] >>> i2) != 0) {
					arg0[arg12] = arg1;
				}
				arg12++;
				arg2 += j1;
				arg3 += k1;
				if ((arg1 = arg4[(arg3 & 0x3f80) + (arg2 >> 7)] >>> i2) != 0) {
					arg0[arg12] = arg1;
				}
				arg12++;
				arg2 += j1;
				arg3 += k1;
				if ((arg1 = arg4[(arg3 & 0x3f80) + (arg2 >> 7)] >>> i2) != 0) {
					arg0[arg12] = arg1;
				}
				arg12++;
				arg2 += j1;
				arg3 += k1;
				if ((arg1 = arg4[(arg3 & 0x3f80) + (arg2 >> 7)] >>> i2) != 0) {
					arg0[arg12] = arg1;
				}
				arg12++;
				arg2 += j1;
				arg3 += k1;
				arg2 = (arg2 & 0x3fff) + (arg13 & 0x600000);
				i2 = arg13 >> 23;
				arg13 += arg14;
				if ((arg1 = arg4[(arg3 & 0x3f80) + (arg2 >> 7)] >>> i2) != 0) {
					arg0[arg12] = arg1;
				}
				arg12++;
				arg2 += j1;
				arg3 += k1;
				if ((arg1 = arg4[(arg3 & 0x3f80) + (arg2 >> 7)] >>> i2) != 0) {
					arg0[arg12] = arg1;
				}
				arg12++;
				arg2 += j1;
				arg3 += k1;
				if ((arg1 = arg4[(arg3 & 0x3f80) + (arg2 >> 7)] >>> i2) != 0) {
					arg0[arg12] = arg1;
				}
				arg12++;
				arg2 += j1;
				arg3 += k1;
				if ((arg1 = arg4[(arg3 & 0x3f80) + (arg2 >> 7)] >>> i2) != 0) {
					arg0[arg12] = arg1;
				}
				arg12++;
				arg2 += j1;
				arg3 += k1;
				arg2 = (arg2 & 0x3fff) + (arg13 & 0x600000);
				i2 = arg13 >> 23;
				arg13 += arg14;
				if ((arg1 = arg4[(arg3 & 0x3f80) + (arg2 >> 7)] >>> i2) != 0) {
					arg0[arg12] = arg1;
				}
				arg12++;
				arg2 += j1;
				arg3 += k1;
				if ((arg1 = arg4[(arg3 & 0x3f80) + (arg2 >> 7)] >>> i2) != 0) {
					arg0[arg12] = arg1;
				}
				arg12++;
				arg2 += j1;
				arg3 += k1;
				if ((arg1 = arg4[(arg3 & 0x3f80) + (arg2 >> 7)] >>> i2) != 0) {
					arg0[arg12] = arg1;
				}
				arg12++;
				arg2 += j1;
				arg3 += k1;
				if ((arg1 = arg4[(arg3 & 0x3f80) + (arg2 >> 7)] >>> i2) != 0) {
					arg0[arg12] = arg1;
				}
				arg12++;
			}
		}

	}

	private static void ki(int arg0[], int arg1[], int arg2, int arg3,
			int arg4, int arg5, int arg6, int arg7, int arg8, int arg9,
			int arg10, int arg11, int arg12, int arg13) {
		if (arg10 <= 0) {
			return;
		}
		int l = 0;
		int i1 = 0;
		arg13 <<= 2;
		if (arg6 != 0) {
			l = arg4 / arg6 << 6;
			i1 = arg5 / arg6 << 6;
		}
		if (l < 0) {
			l = 0;
		} else if (l > 4032) {
			l = 4032;
		}
		for (int l1 = arg10; l1 > 0; l1 -= 16) {
			arg4 += arg7;
			arg5 += arg8;
			arg6 += arg9;
			arg2 = l;
			arg3 = i1;
			if (arg6 != 0) {
				l = arg4 / arg6 << 6;
				i1 = arg5 / arg6 << 6;
			}
			if (l < 0) {
				l = 0;
			} else if (l > 4032) {
				l = 4032;
			}
			int j1 = l - arg2 >> 4;
			int k1 = i1 - arg3 >> 4;
			int i2 = arg12 >> 20;
			arg2 += arg12 & 0xc0000;
			arg12 += arg13;
			if (l1 < 16) {
				for (int j2 = 0; j2 < l1; j2++) {
					arg0[arg11++] = arg1[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2;
					arg2 += j1;
					arg3 += k1;
					if ((j2 & 3) == 3) {
						arg2 = (arg2 & 0xfff) + (arg12 & 0xc0000);
						i2 = arg12 >> 20;
						arg12 += arg13;
					}
				}

			} else {
				arg0[arg11++] = arg1[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2;
				arg2 += j1;
				arg3 += k1;
				arg0[arg11++] = arg1[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2;
				arg2 += j1;
				arg3 += k1;
				arg0[arg11++] = arg1[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2;
				arg2 += j1;
				arg3 += k1;
				arg0[arg11++] = arg1[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2;
				arg2 += j1;
				arg3 += k1;
				arg2 = (arg2 & 0xfff) + (arg12 & 0xc0000);
				i2 = arg12 >> 20;
				arg12 += arg13;
				arg0[arg11++] = arg1[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2;
				arg2 += j1;
				arg3 += k1;
				arg0[arg11++] = arg1[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2;
				arg2 += j1;
				arg3 += k1;
				arg0[arg11++] = arg1[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2;
				arg2 += j1;
				arg3 += k1;
				arg0[arg11++] = arg1[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2;
				arg2 += j1;
				arg3 += k1;
				arg2 = (arg2 & 0xfff) + (arg12 & 0xc0000);
				i2 = arg12 >> 20;
				arg12 += arg13;
				arg0[arg11++] = arg1[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2;
				arg2 += j1;
				arg3 += k1;
				arg0[arg11++] = arg1[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2;
				arg2 += j1;
				arg3 += k1;
				arg0[arg11++] = arg1[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2;
				arg2 += j1;
				arg3 += k1;
				arg0[arg11++] = arg1[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2;
				arg2 += j1;
				arg3 += k1;
				arg2 = (arg2 & 0xfff) + (arg12 & 0xc0000);
				i2 = arg12 >> 20;
				arg12 += arg13;
				arg0[arg11++] = arg1[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2;
				arg2 += j1;
				arg3 += k1;
				arg0[arg11++] = arg1[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2;
				arg2 += j1;
				arg3 += k1;
				arg0[arg11++] = arg1[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2;
				arg2 += j1;
				arg3 += k1;
				arg0[arg11++] = arg1[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2;
			}
		}

	}

	private static void qh(int arg0[], int arg1[], int arg2, int arg3,
			int arg4, int arg5, int arg6, int arg7, int arg8, int arg9,
			int arg10, int arg11, int arg12, int arg13) {
		if (arg10 <= 0) {
			return;
		}
		int l = 0;
		int i1 = 0;
		arg13 <<= 2;
		if (arg6 != 0) {
			l = arg4 / arg6 << 6;
			i1 = arg5 / arg6 << 6;
		}
		if (l < 0) {
			l = 0;
		} else if (l > 4032) {
			l = 4032;
		}
		for (int l1 = arg10; l1 > 0; l1 -= 16) {
			arg4 += arg7;
			arg5 += arg8;
			arg6 += arg9;
			arg2 = l;
			arg3 = i1;
			if (arg6 != 0) {
				l = arg4 / arg6 << 6;
				i1 = arg5 / arg6 << 6;
			}
			if (l < 0) {
				l = 0;
			} else if (l > 4032) {
				l = 4032;
			}
			int j1 = l - arg2 >> 4;
			int k1 = i1 - arg3 >> 4;
			int i2 = arg12 >> 20;
			arg2 += arg12 & 0xc0000;
			arg12 += arg13;
			if (l1 < 16) {
				for (int j2 = 0; j2 < l1; j2++) {
					arg0[arg11++] = (arg1[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2)
							+ (arg0[arg11] >> 1 & 0x7f7f7f);
					arg2 += j1;
					arg3 += k1;
					if ((j2 & 3) == 3) {
						arg2 = (arg2 & 0xfff) + (arg12 & 0xc0000);
						i2 = arg12 >> 20;
						arg12 += arg13;
					}
				}

			} else {
				arg0[arg11++] = (arg1[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2)
						+ (arg0[arg11] >> 1 & 0x7f7f7f);
				arg2 += j1;
				arg3 += k1;
				arg0[arg11++] = (arg1[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2)
						+ (arg0[arg11] >> 1 & 0x7f7f7f);
				arg2 += j1;
				arg3 += k1;
				arg0[arg11++] = (arg1[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2)
						+ (arg0[arg11] >> 1 & 0x7f7f7f);
				arg2 += j1;
				arg3 += k1;
				arg0[arg11++] = (arg1[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2)
						+ (arg0[arg11] >> 1 & 0x7f7f7f);
				arg2 += j1;
				arg3 += k1;
				arg2 = (arg2 & 0xfff) + (arg12 & 0xc0000);
				i2 = arg12 >> 20;
				arg12 += arg13;
				arg0[arg11++] = (arg1[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2)
						+ (arg0[arg11] >> 1 & 0x7f7f7f);
				arg2 += j1;
				arg3 += k1;
				arg0[arg11++] = (arg1[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2)
						+ (arg0[arg11] >> 1 & 0x7f7f7f);
				arg2 += j1;
				arg3 += k1;
				arg0[arg11++] = (arg1[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2)
						+ (arg0[arg11] >> 1 & 0x7f7f7f);
				arg2 += j1;
				arg3 += k1;
				arg0[arg11++] = (arg1[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2)
						+ (arg0[arg11] >> 1 & 0x7f7f7f);
				arg2 += j1;
				arg3 += k1;
				arg2 = (arg2 & 0xfff) + (arg12 & 0xc0000);
				i2 = arg12 >> 20;
				arg12 += arg13;
				arg0[arg11++] = (arg1[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2)
						+ (arg0[arg11] >> 1 & 0x7f7f7f);
				arg2 += j1;
				arg3 += k1;
				arg0[arg11++] = (arg1[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2)
						+ (arg0[arg11] >> 1 & 0x7f7f7f);
				arg2 += j1;
				arg3 += k1;
				arg0[arg11++] = (arg1[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2)
						+ (arg0[arg11] >> 1 & 0x7f7f7f);
				arg2 += j1;
				arg3 += k1;
				arg0[arg11++] = (arg1[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2)
						+ (arg0[arg11] >> 1 & 0x7f7f7f);
				arg2 += j1;
				arg3 += k1;
				arg2 = (arg2 & 0xfff) + (arg12 & 0xc0000);
				i2 = arg12 >> 20;
				arg12 += arg13;
				arg0[arg11++] = (arg1[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2)
						+ (arg0[arg11] >> 1 & 0x7f7f7f);
				arg2 += j1;
				arg3 += k1;
				arg0[arg11++] = (arg1[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2)
						+ (arg0[arg11] >> 1 & 0x7f7f7f);
				arg2 += j1;
				arg3 += k1;
				arg0[arg11++] = (arg1[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2)
						+ (arg0[arg11] >> 1 & 0x7f7f7f);
				arg2 += j1;
				arg3 += k1;
				arg0[arg11++] = (arg1[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2)
						+ (arg0[arg11] >> 1 & 0x7f7f7f);
			}
		}

	}

	private static void mh(int arg0[], int arg1, int arg2, int arg3,
			int arg4[], int arg5, int arg6, int arg7, int arg8, int arg9,
			int arg10, int arg11, int arg12, int arg13, int arg14) {
		if (arg11 <= 0) {
			return;
		}
		int l = 0;
		int i1 = 0;
		arg14 <<= 2;
		if (arg7 != 0) {
			l = arg5 / arg7 << 6;
			i1 = arg6 / arg7 << 6;
		}
		if (l < 0) {
			l = 0;
		} else if (l > 4032) {
			l = 4032;
		}
		for (int l1 = arg11; l1 > 0; l1 -= 16) {
			arg5 += arg8;
			arg6 += arg9;
			arg7 += arg10;
			arg2 = l;
			arg3 = i1;
			if (arg7 != 0) {
				l = arg5 / arg7 << 6;
				i1 = arg6 / arg7 << 6;
			}
			if (l < 0) {
				l = 0;
			} else if (l > 4032) {
				l = 4032;
			}
			int j1 = l - arg2 >> 4;
			int k1 = i1 - arg3 >> 4;
			int i2 = arg13 >> 20;
			arg2 += arg13 & 0xc0000;
			arg13 += arg14;
			if (l1 < 16) {
				for (int j2 = 0; j2 < l1; j2++) {
					if ((arg1 = arg4[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2) != 0) {
						arg0[arg12] = arg1;
					}
					arg12++;
					arg2 += j1;
					arg3 += k1;
					if ((j2 & 3) == 3) {
						arg2 = (arg2 & 0xfff) + (arg13 & 0xc0000);
						i2 = arg13 >> 20;
						arg13 += arg14;
					}
				}

			} else {
				if ((arg1 = arg4[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2) != 0) {
					arg0[arg12] = arg1;
				}
				arg12++;
				arg2 += j1;
				arg3 += k1;
				if ((arg1 = arg4[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2) != 0) {
					arg0[arg12] = arg1;
				}
				arg12++;
				arg2 += j1;
				arg3 += k1;
				if ((arg1 = arg4[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2) != 0) {
					arg0[arg12] = arg1;
				}
				arg12++;
				arg2 += j1;
				arg3 += k1;
				if ((arg1 = arg4[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2) != 0) {
					arg0[arg12] = arg1;
				}
				arg12++;
				arg2 += j1;
				arg3 += k1;
				arg2 = (arg2 & 0xfff) + (arg13 & 0xc0000);
				i2 = arg13 >> 20;
				arg13 += arg14;
				if ((arg1 = arg4[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2) != 0) {
					arg0[arg12] = arg1;
				}
				arg12++;
				arg2 += j1;
				arg3 += k1;
				if ((arg1 = arg4[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2) != 0) {
					arg0[arg12] = arg1;
				}
				arg12++;
				arg2 += j1;
				arg3 += k1;
				if ((arg1 = arg4[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2) != 0) {
					arg0[arg12] = arg1;
				}
				arg12++;
				arg2 += j1;
				arg3 += k1;
				if ((arg1 = arg4[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2) != 0) {
					arg0[arg12] = arg1;
				}
				arg12++;
				arg2 += j1;
				arg3 += k1;
				arg2 = (arg2 & 0xfff) + (arg13 & 0xc0000);
				i2 = arg13 >> 20;
				arg13 += arg14;
				if ((arg1 = arg4[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2) != 0) {
					arg0[arg12] = arg1;
				}
				arg12++;
				arg2 += j1;
				arg3 += k1;
				if ((arg1 = arg4[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2) != 0) {
					arg0[arg12] = arg1;
				}
				arg12++;
				arg2 += j1;
				arg3 += k1;
				if ((arg1 = arg4[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2) != 0) {
					arg0[arg12] = arg1;
				}
				arg12++;
				arg2 += j1;
				arg3 += k1;
				if ((arg1 = arg4[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2) != 0) {
					arg0[arg12] = arg1;
				}
				arg12++;
				arg2 += j1;
				arg3 += k1;
				arg2 = (arg2 & 0xfff) + (arg13 & 0xc0000);
				i2 = arg13 >> 20;
				arg13 += arg14;
				if ((arg1 = arg4[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2) != 0) {
					arg0[arg12] = arg1;
				}
				arg12++;
				arg2 += j1;
				arg3 += k1;
				if ((arg1 = arg4[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2) != 0) {
					arg0[arg12] = arg1;
				}
				arg12++;
				arg2 += j1;
				arg3 += k1;
				if ((arg1 = arg4[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2) != 0) {
					arg0[arg12] = arg1;
				}
				arg12++;
				arg2 += j1;
				arg3 += k1;
				if ((arg1 = arg4[(arg3 & 0xfc0) + (arg2 >> 6)] >>> i2) != 0) {
					arg0[arg12] = arg1;
				}
				arg12++;
			}
		}

	}

	private static void dh(int arg0[], int arg1, int arg2, int arg3,
			int arg4[], int arg5, int arg6) {
		if (arg1 >= 0) {
			return;
		}
		arg6 <<= 1;
		arg3 = arg4[arg5 >> 8 & 0xff];
		arg5 += arg6;
		int l = arg1 / 8;
		for (int i1 = l; i1 < 0; i1++) {
			arg0[arg2++] = arg3;
			arg0[arg2++] = arg3;
			arg3 = arg4[arg5 >> 8 & 0xff];
			arg5 += arg6;
			arg0[arg2++] = arg3;
			arg0[arg2++] = arg3;
			arg3 = arg4[arg5 >> 8 & 0xff];
			arg5 += arg6;
			arg0[arg2++] = arg3;
			arg0[arg2++] = arg3;
			arg3 = arg4[arg5 >> 8 & 0xff];
			arg5 += arg6;
			arg0[arg2++] = arg3;
			arg0[arg2++] = arg3;
			arg3 = arg4[arg5 >> 8 & 0xff];
			arg5 += arg6;
		}

		l = -(arg1 % 8);
		for (int j1 = 0; j1 < l; j1++) {
			arg0[arg2++] = arg3;
			if ((j1 & 1) == 1) {
				arg3 = arg4[arg5 >> 8 & 0xff];
				arg5 += arg6;
			}
		}

	}

	private static void bi(int arg0[], int arg1, int arg2, int arg3,
			int arg4[], int arg5, int arg6) {
		if (arg1 >= 0) {
			return;
		}
		arg6 <<= 2;
		arg3 = arg4[arg5 >> 8 & 0xff];
		arg5 += arg6;
		int l = arg1 / 16;
		for (int i1 = l; i1 < 0; i1++) {
			arg0[arg2++] = arg3 + (arg0[arg2] >> 1 & 0x7f7f7f);
			arg0[arg2++] = arg3 + (arg0[arg2] >> 1 & 0x7f7f7f);
			arg0[arg2++] = arg3 + (arg0[arg2] >> 1 & 0x7f7f7f);
			arg0[arg2++] = arg3 + (arg0[arg2] >> 1 & 0x7f7f7f);
			arg3 = arg4[arg5 >> 8 & 0xff];
			arg5 += arg6;
			arg0[arg2++] = arg3 + (arg0[arg2] >> 1 & 0x7f7f7f);
			arg0[arg2++] = arg3 + (arg0[arg2] >> 1 & 0x7f7f7f);
			arg0[arg2++] = arg3 + (arg0[arg2] >> 1 & 0x7f7f7f);
			arg0[arg2++] = arg3 + (arg0[arg2] >> 1 & 0x7f7f7f);
			arg3 = arg4[arg5 >> 8 & 0xff];
			arg5 += arg6;
			arg0[arg2++] = arg3 + (arg0[arg2] >> 1 & 0x7f7f7f);
			arg0[arg2++] = arg3 + (arg0[arg2] >> 1 & 0x7f7f7f);
			arg0[arg2++] = arg3 + (arg0[arg2] >> 1 & 0x7f7f7f);
			arg0[arg2++] = arg3 + (arg0[arg2] >> 1 & 0x7f7f7f);
			arg3 = arg4[arg5 >> 8 & 0xff];
			arg5 += arg6;
			arg0[arg2++] = arg3 + (arg0[arg2] >> 1 & 0x7f7f7f);
			arg0[arg2++] = arg3 + (arg0[arg2] >> 1 & 0x7f7f7f);
			arg0[arg2++] = arg3 + (arg0[arg2] >> 1 & 0x7f7f7f);
			arg0[arg2++] = arg3 + (arg0[arg2] >> 1 & 0x7f7f7f);
			arg3 = arg4[arg5 >> 8 & 0xff];
			arg5 += arg6;
		}

		l = -(arg1 % 16);
		for (int j1 = 0; j1 < l; j1++) {
			arg0[arg2++] = arg3 + (arg0[arg2] >> 1 & 0x7f7f7f);
			if ((j1 & 3) == 3) {
				arg3 = arg4[arg5 >> 8 & 0xff];
				arg5 += arg6;
				arg5 += arg6;
			}
		}

	}

	private static void rh(int arg0[], int arg1, int arg2, int arg3,
			int arg4[], int arg5, int arg6) {
		if (arg1 >= 0) {
			return;
		}
		arg6 <<= 2;
		arg3 = arg4[arg5 >> 8 & 0xff];
		arg5 += arg6;
		int l = arg1 / 16;
		for (int i1 = l; i1 < 0; i1++) {
			arg0[arg2++] = arg3;
			arg0[arg2++] = arg3;
			arg0[arg2++] = arg3;
			arg0[arg2++] = arg3;
			arg3 = arg4[arg5 >> 8 & 0xff];
			arg5 += arg6;
			arg0[arg2++] = arg3;
			arg0[arg2++] = arg3;
			arg0[arg2++] = arg3;
			arg0[arg2++] = arg3;
			arg3 = arg4[arg5 >> 8 & 0xff];
			arg5 += arg6;
			arg0[arg2++] = arg3;
			arg0[arg2++] = arg3;
			arg0[arg2++] = arg3;
			arg0[arg2++] = arg3;
			arg3 = arg4[arg5 >> 8 & 0xff];
			arg5 += arg6;
			arg0[arg2++] = arg3;
			arg0[arg2++] = arg3;
			arg0[arg2++] = arg3;
			arg0[arg2++] = arg3;
			arg3 = arg4[arg5 >> 8 & 0xff];
			arg5 += arg6;
		}

		l = -(arg1 % 16);
		for (int j1 = 0; j1 < l; j1++) {
			arg0[arg2++] = arg3;
			if ((j1 & 3) == 3) {
				arg3 = arg4[arg5 >> 8 & 0xff];
				arg5 += arg6;
			}
		}

	}

	public void uh(int arg0, int arg1, int arg2, int arg3, int arg4, int arg5,
			int arg6) {
		dn = 1024 - arg3 & 0x3ff;
		en = 1024 - arg4 & 0x3ff;
		fn = 1024 - arg5 & 0x3ff;
		int l = 0;
		int i1 = 0;
		int j1 = arg6;
		if (arg3 != 0) {
			int k1 = hm[arg3];
			int j2 = hm[arg3 + 1024];
			int i3 = i1 * j2 - j1 * k1 >> 15;
			j1 = i1 * k1 + j1 * j2 >> 15;
			i1 = i3;
		}
		if (arg4 != 0) {
			int l1 = hm[arg4];
			int k2 = hm[arg4 + 1024];
			int j3 = j1 * l1 + l * k2 >> 15;
			j1 = j1 * k2 - l * l1 >> 15;
			l = j3;
		}
		if (arg5 != 0) {
			int i2 = hm[arg5];
			int l2 = hm[arg5 + 1024];
			int k3 = i1 * i2 + l * l2 >> 15;
			i1 = i1 * l2 - l * i2 >> 15;
			l = k3;
		}
		an = arg0 - l;
		bn = arg1 - i1;
		cn = arg2 - j1;
	}

	private void ri(int arg0) {
		CameraModel q1 = ln[arg0];
		Model h1 = q1.hfb;
		int l = q1.ifb;
		int ai1[] = h1.tg[l];
		int i1 = h1.sg[l];
		int j1 = h1.xg[l];
		int l1 = h1.kg[ai1[0]];
		int i2 = h1.lg[ai1[0]];
		int j2 = h1.mg[ai1[0]];
		int k2 = h1.kg[ai1[1]] - l1;
		int l2 = h1.lg[ai1[1]] - i2;
		int i3 = h1.mg[ai1[1]] - j2;
		int j3 = h1.kg[ai1[2]] - l1;
		int k3 = h1.lg[ai1[2]] - i2;
		int l3 = h1.mg[ai1[2]] - j2;
		int i4 = l2 * l3 - k3 * i3;
		int j4 = i3 * j3 - l3 * k2;
		int k4 = k2 * k3 - j3 * l2;
		if (j1 == -1) {
			j1 = 0;
			for (; i4 > 25000 || j4 > 25000 || k4 > 25000 || i4 < -25000
					|| j4 < -25000 || k4 < -25000; k4 >>= 1) {
				j1++;
				i4 >>= 1;
				j4 >>= 1;
			}

			h1.xg[l] = j1;
			h1.wg[l] = (int) ((double) zm * Math.sqrt(i4 * i4 + j4 * j4 + k4
					* k4));
		} else {
			i4 >>= j1;
			j4 >>= j1;
			k4 >>= j1;
		}
		q1.nfb = l1 * i4 + i2 * j4 + j2 * k4;
		q1.kfb = i4;
		q1.lfb = j4;
		q1.mfb = k4;
		int l4 = h1.mg[ai1[0]];
		int i5 = l4;
		int j5 = h1.ng[ai1[0]];
		int k5 = j5;
		int l5 = h1.og[ai1[0]];
		int i6 = l5;
		for (int j6 = 1; j6 < i1; j6++) {
			int k1 = h1.mg[ai1[j6]];
			if (k1 > i5) {
				i5 = k1;
			} else if (k1 < l4) {
				l4 = k1;
			}
			k1 = h1.ng[ai1[j6]];
			if (k1 > k5) {
				k5 = k1;
			} else if (k1 < j5) {
				j5 = k1;
			}
			k1 = h1.og[ai1[j6]];
			if (k1 > i6) {
				i6 = k1;
			} else if (k1 < l5) {
				l5 = k1;
			}
		}

		q1.ffb = l4;
		q1.gfb = i5;
		q1.bfb = j5;
		q1.dfb = k5;
		q1.cfb = l5;
		q1.efb = i6;
	}

	private void ti(int arg0) {
		CameraModel q1 = ln[arg0];
		Model h1 = q1.hfb;
		int l = q1.ifb;
		int ai1[] = h1.tg[l];
		int j1 = 0;
		int k1 = 0;
		int l1 = 1;
		int i2 = h1.kg[ai1[0]];
		int j2 = h1.lg[ai1[0]];
		int k2 = h1.mg[ai1[0]];
		h1.wg[l] = 1;
		h1.xg[l] = 0;
		q1.nfb = i2 * j1 + j2 * k1 + k2 * l1;
		q1.kfb = j1;
		q1.lfb = k1;
		q1.mfb = l1;
		int l2 = h1.mg[ai1[0]];
		int i3 = l2;
		int j3 = h1.ng[ai1[0]];
		int k3 = j3;
		if (h1.ng[ai1[1]] < j3) {
			j3 = h1.ng[ai1[1]];
		} else {
			k3 = h1.ng[ai1[1]];
		}
		int l3 = h1.og[ai1[1]];
		int i4 = h1.og[ai1[0]];
		int i1 = h1.mg[ai1[1]];
		if (i1 > i3) {
			i3 = i1;
		} else if (i1 < l2) {
			l2 = i1;
		}
		i1 = h1.ng[ai1[1]];
		if (i1 > k3) {
			k3 = i1;
		} else if (i1 < j3) {
			j3 = i1;
		}
		i1 = h1.og[ai1[1]];
		if (i1 > i4) {
			i4 = i1;
		} else if (i1 < l3) {
			l3 = i1;
		}
		q1.ffb = l2;
		q1.gfb = i3;
		q1.bfb = j3 - 20;
		q1.dfb = k3 + 20;
		q1.cfb = l3;
		q1.efb = i4;
	}

	private boolean ch(CameraModel arg0, CameraModel arg1) {
		if (arg0.bfb >= arg1.dfb) {
			return true;
		}
		if (arg1.bfb >= arg0.dfb) {
			return true;
		}
		if (arg0.cfb >= arg1.efb) {
			return true;
		}
		if (arg1.cfb >= arg0.efb) {
			return true;
		}
		if (arg0.ffb >= arg1.gfb) {
			return true;
		}
		if (arg1.ffb > arg0.gfb) {
			return false;
		}
		Model h1 = arg0.hfb;
		Model h2 = arg1.hfb;
		int l = arg0.ifb;
		int i1 = arg1.ifb;
		int ai1[] = h1.tg[l];
		int ai2[] = h2.tg[i1];
		int j1 = h1.sg[l];
		int k1 = h2.sg[i1];
		int j3 = h2.kg[ai2[0]];
		int k3 = h2.lg[ai2[0]];
		int l3 = h2.mg[ai2[0]];
		int i4 = arg1.kfb;
		int j4 = arg1.lfb;
		int k4 = arg1.mfb;
		int l4 = h2.wg[i1];
		int i5 = arg1.nfb;
		boolean flag = false;
		for (int j5 = 0; j5 < j1; j5++) {
			int l1 = ai1[j5];
			int l2 = (j3 - h1.kg[l1]) * i4 + (k3 - h1.lg[l1]) * j4
					+ (l3 - h1.mg[l1]) * k4;
			if ((l2 >= -l4 || i5 >= 0) && (l2 <= l4 || i5 <= 0)) {
				continue;
			}
			flag = true;
			break;
		}

		if (!flag) {
			return true;
		}
		j3 = h1.kg[ai1[0]];
		k3 = h1.lg[ai1[0]];
		l3 = h1.mg[ai1[0]];
		i4 = arg0.kfb;
		j4 = arg0.lfb;
		k4 = arg0.mfb;
		l4 = h1.wg[l];
		i5 = arg0.nfb;
		flag = false;
		for (int k5 = 0; k5 < k1; k5++) {
			int i2 = ai2[k5];
			int i3 = (j3 - h2.kg[i2]) * i4 + (k3 - h2.lg[i2]) * j4
					+ (l3 - h2.mg[i2]) * k4;
			if ((i3 >= -l4 || i5 <= 0) && (i3 <= l4 || i5 >= 0)) {
				continue;
			}
			flag = true;
			break;
		}

		if (!flag) {
			return true;
		}
		int ai3[];
		int ai4[];
		if (j1 == 2) {
			ai3 = new int[4];
			ai4 = new int[4];
			int l5 = ai1[0];
			int j2 = ai1[1];
			ai3[0] = h1.ng[l5] - 20;
			ai3[1] = h1.ng[j2] - 20;
			ai3[2] = h1.ng[j2] + 20;
			ai3[3] = h1.ng[l5] + 20;
			ai4[0] = ai4[3] = h1.og[l5];
			ai4[1] = ai4[2] = h1.og[j2];
		} else {
			ai3 = new int[j1];
			ai4 = new int[j1];
			for (int i6 = 0; i6 < j1; i6++) {
				int l6 = ai1[i6];
				ai3[i6] = h1.ng[l6];
				ai4[i6] = h1.og[l6];
			}

		}
		int ai5[];
		int ai6[];
		if (k1 == 2) {
			ai5 = new int[4];
			ai6 = new int[4];
			int j6 = ai2[0];
			int k2 = ai2[1];
			ai5[0] = h2.ng[j6] - 20;
			ai5[1] = h2.ng[k2] - 20;
			ai5[2] = h2.ng[k2] + 20;
			ai5[3] = h2.ng[j6] + 20;
			ai6[0] = ai6[3] = h2.og[j6];
			ai6[1] = ai6[2] = h2.og[k2];
		} else {
			ai5 = new int[k1];
			ai6 = new int[k1];
			for (int k6 = 0; k6 < k1; k6++) {
				int i7 = ai2[k6];
				ai5[k6] = h2.ng[i7];
				ai6[k6] = h2.og[i7];
			}

		}
		return !eh(ai3, ai4, ai5, ai6);
	}

	private boolean ah(CameraModel arg0, CameraModel arg1) {
		Model h1 = arg0.hfb;
		Model h2 = arg1.hfb;
		int l = arg0.ifb;
		int i1 = arg1.ifb;
		int ai1[] = h1.tg[l];
		int ai2[] = h2.tg[i1];
		int j1 = h1.sg[l];
		int k1 = h2.sg[i1];
		int l2 = h2.kg[ai2[0]];
		int i3 = h2.lg[ai2[0]];
		int j3 = h2.mg[ai2[0]];
		int k3 = arg1.kfb;
		int l3 = arg1.lfb;
		int i4 = arg1.mfb;
		int j4 = h2.wg[i1];
		int k4 = arg1.nfb;
		boolean flag = false;
		for (int l4 = 0; l4 < j1; l4++) {
			int l1 = ai1[l4];
			int j2 = (l2 - h1.kg[l1]) * k3 + (i3 - h1.lg[l1]) * l3
					+ (j3 - h1.mg[l1]) * i4;
			if ((j2 >= -j4 || k4 >= 0) && (j2 <= j4 || k4 <= 0)) {
				continue;
			}
			flag = true;
			break;
		}

		if (!flag) {
			return true;
		}
		l2 = h1.kg[ai1[0]];
		i3 = h1.lg[ai1[0]];
		j3 = h1.mg[ai1[0]];
		k3 = arg0.kfb;
		l3 = arg0.lfb;
		i4 = arg0.mfb;
		j4 = h1.wg[l];
		k4 = arg0.nfb;
		flag = false;
		for (int i5 = 0; i5 < k1; i5++) {
			int i2 = ai2[i5];
			int k2 = (l2 - h2.kg[i2]) * k3 + (i3 - h2.lg[i2]) * l3
					+ (j3 - h2.mg[i2]) * i4;
			if ((k2 >= -j4 || k4 <= 0) && (k2 <= j4 || k4 >= 0)) {
				continue;
			}
			flag = true;
			break;
		}

		return !flag;
	}

	public void yg(String arg0, int arg1, int arg2, int arg3, GameWindow arg4) {
		try {
			io = arg4.updareProgressBar(arg0, "textures", arg3);
			byte abyte0[] = DataOperations.lm("textures.txt", 0, io);
			CacheLoader a1 = new CacheLoader(abyte0);
			a1.qb();
			ao = a1.vb();
			bo = new String[ao];
			fo = new boolean[ao];
			eo = new long[ao];
			co = new int[ao];
			_flddo = new int[ao];
			go = new int[ao][];
			for (int l = 0; l < ao; l++) {
				a1.qb();
				bo[l] = a1.wb();
				co[l] = a1.rb();
				_flddo[l] = a1.vb();
				fo[l] = false;
				go[l] = null;
				eo[l] = 0L;
			}

			ho = 0L;
			jo = new int[arg1][];
			ko = new int[arg2][];
			for (int i1 = 0; i1 < ao; i1++) {
				fi(i1);
			}

			return;
		} catch (IOException _ex) {
			System.out.println("Error loading texture set");
		}
	}

	public void ai(int arg0) {
		if (go[arg0] == null) {
			return;
		}
		int ai1[] = go[arg0];
		for (int l = 0; l < 64; l++) {
			int i1 = l + 4032;
			int j1 = ai1[i1];
			for (int l1 = 0; l1 < 63; l1++) {
				ai1[i1] = ai1[i1 - 64];
				i1 -= 64;
			}

			go[arg0][i1] = j1;
		}

		char c = '\u1000';
		for (int k1 = 0; k1 < c; k1++) {
			int i2 = ai1[k1];
			ai1[c + k1] = i2 - (i2 >>> 3) & 0xf8f8ff;
			ai1[c * 2 + k1] = i2 - (i2 >>> 2) & 0xf8f8ff;
			ai1[c * 3 + k1] = i2 - (i2 >>> 2) - (i2 >>> 3) & 0xf8f8ff;
		}

	}

	public void fi(int arg0) {
		if (arg0 < 0) {
			return;
		}
		eo[arg0] = ho++;
		if (go[arg0] != null) {
			return;
		}
		if (_flddo[arg0] == 0) {
			for (int l = 0; l < jo.length; l++) {
				if (jo[l] == null) {
					jo[l] = new int[16384];
					go[arg0] = jo[l];
					DataOperations.ym(bo[arg0] + ".tga", 0, io, lo);
					di(arg0);
					return;
				}
			}

			long l1 = 1L << 30;
			int j1 = 0;
			for (int i2 = 0; i2 < ao; i2++) {
				if (i2 != arg0 && _flddo[i2] == 0 && go[i2] != null
						&& eo[i2] < l1) {
					l1 = eo[i2];
					j1 = i2;
				}
			}

			go[arg0] = go[j1];
			go[j1] = null;
			DataOperations.ym(bo[arg0] + ".tga", 0, io, lo);
			di(arg0);
			return;
		}
		for (int i1 = 0; i1 < ko.length; i1++) {
			if (ko[i1] == null) {
				ko[i1] = new int[0x10000];
				go[arg0] = ko[i1];
				DataOperations.ym(bo[arg0] + ".tga", 0, io, lo);
				di(arg0);
				return;
			}
		}

		long l2 = 1L << 30;
		int k1 = 0;
		for (int j2 = 0; j2 < ao; j2++) {
			if (j2 != arg0 && _flddo[j2] == 1 && go[j2] != null && eo[j2] < l2) {
				l2 = eo[j2];
				k1 = j2;
			}
		}

		go[arg0] = go[k1];
		go[k1] = null;
		DataOperations.ym(bo[arg0] + ".tga", 0, io, lo);
		di(arg0);
	}

	public void gi(String arg0) {
		try {
			CacheLoader a1 = new CacheLoader(arg0 + "/textures.txt");
			a1.qb();
			ao = a1.vb();
			bo = new String[ao];
			fo = new boolean[ao];
			eo = new long[ao];
			co = new int[ao];
			_flddo = new int[ao];
			go = new int[ao][];
			for (int l = 0; l < ao; l++) {
				a1.qb();
				bo[l] = a1.wb();
				co[l] = a1.rb();
				_flddo[l] = a1.vb();
				fo[l] = false;
			}

			a1.closeStream();
			for (int i1 = 0; i1 < ao; i1++) {
				char c;
				if (_flddo[i1] == 0) {
					c = '\u151B';
				} else {
					c = '\u451B';
				}
				char c1;
				if (_flddo[i1] == 0) {
					c1 = '@';
				} else {
					c1 = '\200';
				}
				go[i1] = new int[c1 * c1 * 4];
				DataOperations
						.readFromPath(arg0 + "/" + bo[i1] + ".tga", lo, c);
				di(i1);
			}

			return;
		} catch (IOException _ex) {
			System.out.println("Error loading texture set");
		}
	}

	private void di(int arg0) {
		char c;
		if (_flddo[arg0] == 0) {
			c = '@';
		} else {
			c = '\200';
		}
		int ai1[] = go[arg0];
		int l = 0;
		for (int i1 = 0; i1 < 256; i1++) {
			mo[i1] = ((lo[20 + i1 * 3] & 0xff) << 16)
					+ ((lo[19 + i1 * 3] & 0xff) << 8)
					+ (lo[18 + i1 * 3] & 0xff);
		}

		for (int j1 = c - 1; j1 >= 0; j1--) {
			for (int k1 = 0; k1 < c; k1++) {
				int i2 = mo[lo[786 + k1 + j1 * c] & 0xff];
				if (i2 != 0xff00ff && co[arg0] != 0) {
					int k2 = i2 >> 16 & 0xff;
					int l2 = i2 >> 8 & 0xff;
					int i3 = i2 & 0xff;
					if (k2 == l2 && l2 == i3) {
						int j3 = co[arg0] >> 16 & 0xff;
						int k3 = co[arg0] >> 8 & 0xff;
						int l3 = co[arg0] & 0xff;
						i2 = ((k2 * j3 >> 8) << 16) + ((l2 * k3 >> 8) << 8)
								+ (i3 * l3 >> 8);
					}
				}
				i2 &= 0xf8f8ff;
				if (i2 == 0) {
					i2 = 1;
				} else if (i2 == 0xf800ff) {
					i2 = 0;
					fo[arg0] = true;
				}
				ai1[l++] = i2;
			}

		}

		for (int l1 = 0; l1 < l; l1++) {
			int j2 = ai1[l1];
			ai1[l + l1] = j2 - (j2 >>> 3) & 0xf8f8ff;
			ai1[l * 2 + l1] = j2 - (j2 >>> 2) & 0xf8f8ff;
			ai1[l * 3 + l1] = j2 - (j2 >>> 2) - (j2 >>> 3) & 0xf8f8ff;
		}

	}

	public int oi(int arg0) {
		if (arg0 == 0xbc614e) {
			return 0;
		}
		fi(arg0);
		if (arg0 >= 0) {
			return go[arg0][0];
		}
		if (arg0 < 0) {
			arg0 = -(arg0 + 1);
			int l = arg0 >> 10 & 0x1f;
			int i1 = arg0 >> 5 & 0x1f;
			int j1 = arg0 & 0x1f;
			return (l << 19) + (i1 << 11) + (j1 << 3);
		} else {
			return 0;
		}
	}

	public void xh(int arg0, int arg1, int arg2) {
		if (arg0 == 0 && arg1 == 0 && arg2 == 0) {
			arg0 = 32;
		}
		for (int l = 0; l < gn; l++) {
			in[l].se(arg0, arg1, arg2);
		}

	}

	public void th(boolean arg0, int arg1, int arg2, int arg3, int arg4,
			int arg5) {
		if (arg3 == 0 && arg4 == 0 && arg5 == 0) {
			arg3 = 32;
		}
		for (int l = 0; l < gn; l++) {
			in[l].ne(arg0, arg1, arg2, arg3, arg4, arg5);
		}

	}

	public static int zh(int arg0, int arg1, int arg2) {
		return -1 - (arg0 / 8) * 1024 - (arg1 / 8) * 32 - arg2 / 8;
	}

	public int hh(int arg0, int arg1, int arg2, int arg3, int arg4) {
		if (arg3 == arg1) {
			return arg0;
		} else {
			return arg0 + ((arg2 - arg0) * (arg4 - arg1)) / (arg3 - arg1);
		}
	}

	public boolean wh(int arg0, int arg1, int arg2, int arg3, boolean arg4) {
		if (arg4 && arg0 <= arg2 || arg0 < arg2) {
			if (arg0 > arg3) {
				return true;
			}
			if (arg1 > arg2) {
				return true;
			}
			if (arg1 > arg3) {
				return true;
			}
			return !arg4;
		}
		if (arg0 < arg3) {
			return true;
		}
		if (arg1 < arg2) {
			return true;
		}
		if (arg1 < arg3) {
			return true;
		} else {
			return arg4;
		}
	}

	public boolean lh(int arg0, int arg1, int arg2, boolean arg3) {
		if (arg3 && arg0 <= arg2 || arg0 < arg2) {
			if (arg1 > arg2) {
				return true;
			}
			return !arg3;
		}
		if (arg1 < arg2) {
			return true;
		} else {
			return arg3;
		}
	}

	public boolean eh(int arg0[], int arg1[], int arg2[], int arg3[]) {
		int l = arg0.length;
		int i1 = arg2.length;
		byte byte0 = 0;
		int l20;
		int j21 = l20 = arg1[0];
		int j1 = 0;
		int i21;
		int k21 = i21 = arg3[0];
		int l1 = 0;
		for (int l21 = 1; l21 < l; l21++) {
			if (arg1[l21] < l20) {
				l20 = arg1[l21];
				j1 = l21;
			} else if (arg1[l21] > j21) {
				j21 = arg1[l21];
			}
		}

		for (int i22 = 1; i22 < i1; i22++) {
			if (arg3[i22] < i21) {
				i21 = arg3[i22];
				l1 = i22;
			} else if (arg3[i22] > k21) {
				k21 = arg3[i22];
			}
		}

		if (i21 >= j21) {
			return false;
		}
		if (l20 >= k21) {
			return false;
		}
		int k1;
		int i2;
		boolean flag;
		if (arg1[j1] < arg3[l1]) {
			for (k1 = j1; arg1[k1] < arg3[l1]; k1 = (k1 + 1) % l) {
				;
			}
			for (; arg1[j1] < arg3[l1]; j1 = ((j1 - 1) + l) % l) {
				;
			}
			int j2 = hh(arg0[(j1 + 1) % l], arg1[(j1 + 1) % l], arg0[j1],
					arg1[j1], arg3[l1]);
			int j7 = hh(arg0[((k1 - 1) + l) % l], arg1[((k1 - 1) + l) % l],
					arg0[k1], arg1[k1], arg3[l1]);
			int k11 = arg2[l1];
			flag = (j2 < k11) | (j7 < k11);
			if (lh(j2, j7, k11, flag)) {
				return true;
			}
			i2 = (l1 + 1) % i1;
			l1 = ((l1 - 1) + i1) % i1;
			if (j1 == k1) {
				byte0 = 1;
			}
		} else {
			for (i2 = l1; arg3[i2] < arg1[j1]; i2 = (i2 + 1) % i1) {
				;
			}
			for (; arg3[l1] < arg1[j1]; l1 = ((l1 - 1) + i1) % i1) {
				;
			}
			int k2 = arg0[j1];
			int l11 = hh(arg2[(l1 + 1) % i1], arg3[(l1 + 1) % i1], arg2[l1],
					arg3[l1], arg1[j1]);
			int k16 = hh(arg2[((i2 - 1) + i1) % i1],
					arg3[((i2 - 1) + i1) % i1], arg2[i2], arg3[i2], arg1[j1]);
			flag = (k2 < l11) | (k2 < k16);
			if (lh(l11, k16, k2, !flag)) {
				return true;
			}
			k1 = (j1 + 1) % l;
			j1 = ((j1 - 1) + l) % l;
			if (l1 == i2) {
				byte0 = 2;
			}
		}
		while (byte0 == 0) {
			if (arg1[j1] < arg1[k1]) {
				if (arg1[j1] < arg3[l1]) {
					if (arg1[j1] < arg3[i2]) {
						int l2 = arg0[j1];
						int k7 = hh(arg0[((k1 - 1) + l) % l],
								arg1[((k1 - 1) + l) % l], arg0[k1], arg1[k1],
								arg1[j1]);
						int i12 = hh(arg2[(l1 + 1) % i1], arg3[(l1 + 1) % i1],
								arg2[l1], arg3[l1], arg1[j1]);
						int l16 = hh(arg2[((i2 - 1) + i1) % i1],
								arg3[((i2 - 1) + i1) % i1], arg2[i2], arg3[i2],
								arg1[j1]);
						if (wh(l2, k7, i12, l16, flag)) {
							return true;
						}
						j1 = ((j1 - 1) + l) % l;
						if (j1 == k1) {
							byte0 = 1;
						}
					} else {
						int i3 = hh(arg0[(j1 + 1) % l], arg1[(j1 + 1) % l],
								arg0[j1], arg1[j1], arg3[i2]);
						int l7 = hh(arg0[((k1 - 1) + l) % l],
								arg1[((k1 - 1) + l) % l], arg0[k1], arg1[k1],
								arg3[i2]);
						int j12 = hh(arg2[(l1 + 1) % i1], arg3[(l1 + 1) % i1],
								arg2[l1], arg3[l1], arg3[i2]);
						int i17 = arg2[i2];
						if (wh(i3, l7, j12, i17, flag)) {
							return true;
						}
						i2 = (i2 + 1) % i1;
						if (l1 == i2) {
							byte0 = 2;
						}
					}
				} else if (arg3[l1] < arg3[i2]) {
					int j3 = hh(arg0[(j1 + 1) % l], arg1[(j1 + 1) % l],
							arg0[j1], arg1[j1], arg3[l1]);
					int i8 = hh(arg0[((k1 - 1) + l) % l], arg1[((k1 - 1) + l)
							% l], arg0[k1], arg1[k1], arg3[l1]);
					int k12 = arg2[l1];
					int j17 = hh(arg2[((i2 - 1) + i1) % i1],
							arg3[((i2 - 1) + i1) % i1], arg2[i2], arg3[i2],
							arg3[l1]);
					if (wh(j3, i8, k12, j17, flag)) {
						return true;
					}
					l1 = ((l1 - 1) + i1) % i1;
					if (l1 == i2) {
						byte0 = 2;
					}
				} else {
					int k3 = hh(arg0[(j1 + 1) % l], arg1[(j1 + 1) % l],
							arg0[j1], arg1[j1], arg3[i2]);
					int j8 = hh(arg0[((k1 - 1) + l) % l], arg1[((k1 - 1) + l)
							% l], arg0[k1], arg1[k1], arg3[i2]);
					int l12 = hh(arg2[(l1 + 1) % i1], arg3[(l1 + 1) % i1],
							arg2[l1], arg3[l1], arg3[i2]);
					int k17 = arg2[i2];
					if (wh(k3, j8, l12, k17, flag)) {
						return true;
					}
					i2 = (i2 + 1) % i1;
					if (l1 == i2) {
						byte0 = 2;
					}
				}
			} else if (arg1[k1] < arg3[l1]) {
				if (arg1[k1] < arg3[i2]) {
					int l3 = hh(arg0[(j1 + 1) % l], arg1[(j1 + 1) % l],
							arg0[j1], arg1[j1], arg1[k1]);
					int k8 = arg0[k1];
					int i13 = hh(arg2[(l1 + 1) % i1], arg3[(l1 + 1) % i1],
							arg2[l1], arg3[l1], arg1[k1]);
					int l17 = hh(arg2[((i2 - 1) + i1) % i1],
							arg3[((i2 - 1) + i1) % i1], arg2[i2], arg3[i2],
							arg1[k1]);
					if (wh(l3, k8, i13, l17, flag)) {
						return true;
					}
					k1 = (k1 + 1) % l;
					if (j1 == k1) {
						byte0 = 1;
					}
				} else {
					int i4 = hh(arg0[(j1 + 1) % l], arg1[(j1 + 1) % l],
							arg0[j1], arg1[j1], arg3[i2]);
					int l8 = hh(arg0[((k1 - 1) + l) % l], arg1[((k1 - 1) + l)
							% l], arg0[k1], arg1[k1], arg3[i2]);
					int j13 = hh(arg2[(l1 + 1) % i1], arg3[(l1 + 1) % i1],
							arg2[l1], arg3[l1], arg3[i2]);
					int i18 = arg2[i2];
					if (wh(i4, l8, j13, i18, flag)) {
						return true;
					}
					i2 = (i2 + 1) % i1;
					if (l1 == i2) {
						byte0 = 2;
					}
				}
			} else if (arg3[l1] < arg3[i2]) {
				int j4 = hh(arg0[(j1 + 1) % l], arg1[(j1 + 1) % l], arg0[j1],
						arg1[j1], arg3[l1]);
				int i9 = hh(arg0[((k1 - 1) + l) % l], arg1[((k1 - 1) + l) % l],
						arg0[k1], arg1[k1], arg3[l1]);
				int k13 = arg2[l1];
				int j18 = hh(arg2[((i2 - 1) + i1) % i1], arg3[((i2 - 1) + i1)
						% i1], arg2[i2], arg3[i2], arg3[l1]);
				if (wh(j4, i9, k13, j18, flag)) {
					return true;
				}
				l1 = ((l1 - 1) + i1) % i1;
				if (l1 == i2) {
					byte0 = 2;
				}
			} else {
				int k4 = hh(arg0[(j1 + 1) % l], arg1[(j1 + 1) % l], arg0[j1],
						arg1[j1], arg3[i2]);
				int j9 = hh(arg0[((k1 - 1) + l) % l], arg1[((k1 - 1) + l) % l],
						arg0[k1], arg1[k1], arg3[i2]);
				int l13 = hh(arg2[(l1 + 1) % i1], arg3[(l1 + 1) % i1],
						arg2[l1], arg3[l1], arg3[i2]);
				int k18 = arg2[i2];
				if (wh(k4, j9, l13, k18, flag)) {
					return true;
				}
				i2 = (i2 + 1) % i1;
				if (l1 == i2) {
					byte0 = 2;
				}
			}
		}
		while (byte0 == 1) {
			if (arg1[j1] < arg3[l1]) {
				if (arg1[j1] < arg3[i2]) {
					int l4 = arg0[j1];
					int i14 = hh(arg2[(l1 + 1) % i1], arg3[(l1 + 1) % i1],
							arg2[l1], arg3[l1], arg1[j1]);
					int l18 = hh(arg2[((i2 - 1) + i1) % i1],
							arg3[((i2 - 1) + i1) % i1], arg2[i2], arg3[i2],
							arg1[j1]);
					return lh(i14, l18, l4, !flag);
				}
				int i5 = hh(arg0[(j1 + 1) % l], arg1[(j1 + 1) % l], arg0[j1],
						arg1[j1], arg3[i2]);
				int k9 = hh(arg0[((k1 - 1) + l) % l], arg1[((k1 - 1) + l) % l],
						arg0[k1], arg1[k1], arg3[i2]);
				int j14 = hh(arg2[(l1 + 1) % i1], arg3[(l1 + 1) % i1],
						arg2[l1], arg3[l1], arg3[i2]);
				int i19 = arg2[i2];
				if (wh(i5, k9, j14, i19, flag)) {
					return true;
				}
				i2 = (i2 + 1) % i1;
				if (l1 == i2) {
					byte0 = 0;
				}
			} else if (arg3[l1] < arg3[i2]) {
				int j5 = hh(arg0[(j1 + 1) % l], arg1[(j1 + 1) % l], arg0[j1],
						arg1[j1], arg3[l1]);
				int l9 = hh(arg0[((k1 - 1) + l) % l], arg1[((k1 - 1) + l) % l],
						arg0[k1], arg1[k1], arg3[l1]);
				int k14 = arg2[l1];
				int j19 = hh(arg2[((i2 - 1) + i1) % i1], arg3[((i2 - 1) + i1)
						% i1], arg2[i2], arg3[i2], arg3[l1]);
				if (wh(j5, l9, k14, j19, flag)) {
					return true;
				}
				l1 = ((l1 - 1) + i1) % i1;
				if (l1 == i2) {
					byte0 = 0;
				}
			} else {
				int k5 = hh(arg0[(j1 + 1) % l], arg1[(j1 + 1) % l], arg0[j1],
						arg1[j1], arg3[i2]);
				int i10 = hh(arg0[((k1 - 1) + l) % l],
						arg1[((k1 - 1) + l) % l], arg0[k1], arg1[k1], arg3[i2]);
				int l14 = hh(arg2[(l1 + 1) % i1], arg3[(l1 + 1) % i1],
						arg2[l1], arg3[l1], arg3[i2]);
				int k19 = arg2[i2];
				if (wh(k5, i10, l14, k19, flag)) {
					return true;
				}
				i2 = (i2 + 1) % i1;
				if (l1 == i2) {
					byte0 = 0;
				}
			}
		}
		while (byte0 == 2) {
			if (arg3[l1] < arg1[j1]) {
				if (arg3[l1] < arg1[k1]) {
					int l5 = hh(arg0[(j1 + 1) % l], arg1[(j1 + 1) % l],
							arg0[j1], arg1[j1], arg3[l1]);
					int j10 = hh(arg0[((k1 - 1) + l) % l], arg1[((k1 - 1) + l)
							% l], arg0[k1], arg1[k1], arg3[l1]);
					int i15 = arg2[l1];
					return lh(l5, j10, i15, flag);
				}
				int i6 = hh(arg0[(j1 + 1) % l], arg1[(j1 + 1) % l], arg0[j1],
						arg1[j1], arg1[k1]);
				int k10 = arg0[k1];
				int j15 = hh(arg2[(l1 + 1) % i1], arg3[(l1 + 1) % i1],
						arg2[l1], arg3[l1], arg1[k1]);
				int l19 = hh(arg2[((i2 - 1) + i1) % i1], arg3[((i2 - 1) + i1)
						% i1], arg2[i2], arg3[i2], arg1[k1]);
				if (wh(i6, k10, j15, l19, flag)) {
					return true;
				}
				k1 = (k1 + 1) % l;
				if (j1 == k1) {
					byte0 = 0;
				}
			} else if (arg1[j1] < arg1[k1]) {
				int j6 = arg0[j1];
				int l10 = hh(arg0[((k1 - 1) + l) % l],
						arg1[((k1 - 1) + l) % l], arg0[k1], arg1[k1], arg1[j1]);
				int k15 = hh(arg2[(l1 + 1) % i1], arg3[(l1 + 1) % i1],
						arg2[l1], arg3[l1], arg1[j1]);
				int i20 = hh(arg2[((i2 - 1) + i1) % i1], arg3[((i2 - 1) + i1)
						% i1], arg2[i2], arg3[i2], arg1[j1]);
				if (wh(j6, l10, k15, i20, flag)) {
					return true;
				}
				j1 = ((j1 - 1) + l) % l;
				if (j1 == k1) {
					byte0 = 0;
				}
			} else {
				int k6 = hh(arg0[(j1 + 1) % l], arg1[(j1 + 1) % l], arg0[j1],
						arg1[j1], arg1[k1]);
				int i11 = arg0[k1];
				int l15 = hh(arg2[(l1 + 1) % i1], arg3[(l1 + 1) % i1],
						arg2[l1], arg3[l1], arg1[k1]);
				int j20 = hh(arg2[((i2 - 1) + i1) % i1], arg3[((i2 - 1) + i1)
						% i1], arg2[i2], arg3[i2], arg1[k1]);
				if (wh(k6, i11, l15, j20, flag)) {
					return true;
				}
				k1 = (k1 + 1) % l;
				if (j1 == k1) {
					byte0 = 0;
				}
			}
		}
		if (arg1[j1] < arg3[l1]) {
			int l6 = arg0[j1];
			int i16 = hh(arg2[(l1 + 1) % i1], arg3[(l1 + 1) % i1], arg2[l1],
					arg3[l1], arg1[j1]);
			int k20 = hh(arg2[((i2 - 1) + i1) % i1],
					arg3[((i2 - 1) + i1) % i1], arg2[i2], arg3[i2], arg1[j1]);
			return lh(i16, k20, l6, !flag);
		}
		int i7 = hh(arg0[(j1 + 1) % l], arg1[(j1 + 1) % l], arg0[j1], arg1[j1],
				arg3[l1]);
		int j11 = hh(arg0[((k1 - 1) + l) % l], arg1[((k1 - 1) + l) % l],
				arg0[k1], arg1[k1], arg3[l1]);
		int j16 = arg2[l1];
		return lh(i7, j11, j16, flag);
	}

	int xl;
	int yl[];
	int zl[][];
	int am[];
	public int bm;
	public int cm;
	public int zoom1;
	public int zoom2;
	public int zoom3;
	public int zoom4;
	public static int hm[] = new int[2048];
	private static int im[] = new int[512];
	public boolean jm;
	public double km;
	public int lm;
	private boolean mm;
	private int nm;
	private int om;
	private int pm;
	private int qm;
	private Model rm[];
	private int sm[];
	private int tm;
	private int um;
	private int vm;
	private int wm;
	private int xm;
	private int ym;
	private int zm;
	private int an;
	private int bn;
	private int cn;
	private int dn;
	private int en;
	private int fn;
	private int gn;
	private int hn;
	private Model in[];
	private int jn[];
	private int kn;
	private CameraModel ln[];
	private int mn;
	private int nn;
	private int on[];
	private int pn[];
	private int qn[];
	private int rn[];
	private int sn[];
	private int tn[];
	private int un[];
	public Model vn;
	private static final int wn = 16;
	private static final int xn = 4;
	private static final int yn = 5;
	private static final int zn = 0xbc614e;
	int ao;
	String bo[];
	int co[];
	int _flddo[];
	long eo[];
	boolean fo[];
	int go[][];
	private static long ho;
	byte io[];
	int jo[][];
	int ko[][];
	private static byte lo[];
	private static int mo[] = new int[256];
	GameImage no;
	public int oo[];
	CameraVariables po[];
	int qo;
	int ro;
	int so[];
	int to[];
	int uo[];
	int vo[];
	int wo[];
	int xo[];
	boolean yo;
	static int zo;
	static int ap;
	static int bp;
	static int cp;
	static int dp;
	static int ep;
	int fp;
	int gp;

}
